Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Oct 14, 2024
0 parents commit b843d38
Show file tree
Hide file tree
Showing 425 changed files with 44,091 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# v1.0.0
## 10/08/2024

1. [](#new)
* Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2024 Trilby Media

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Grav Ray Plugin

The **Grav Ray** Plugin is an extension for [Grav CMS](https://github.com/getgrav/grav). Grav plugin for the [Spatie Ray](https://myray.app/docs/getting-started/introduction) debugger app.

```php
ray('Hello world');

ray(['a' => 1, 'b' => 2])->color('red');

ray('multiple', 'arguments', 'are', 'welcome');
```

You of course, need to install the [standalone Ray debugger desktop app](https://myray.app/) for the plugin to function properly.

## Installation

Installing the Grav Ray plugin can be done in one of three ways: The GPM (Grav Package Manager) installation method lets you quickly install the plugin with a simple terminal command, the manual method lets you do so via a zip file, and the admin method lets you do so via the Admin Plugin.

### GPM Installation (Preferred)

To install the plugin via the [GPM](https://learn.getgrav.org/cli-console/grav-cli-gpm), through your system's terminal (also called the command line), navigate to the root of your Grav-installation, and enter:

bin/gpm install grav-ray

This will install the Grav Ray plugin into your `/user/plugins`-directory within Grav. Its files can be found under `/your/site/grav/user/plugins/grav-ray`.

### Manual Installation

To install the plugin manually, download the zip-version of this repository and unzip it under `/your/site/grav/user/plugins`. Then rename the folder to `grav-ray`. You can find these files on [GitHub](https://github.com/trilbymedia/grav-plugin-grav-ray) or via [GetGrav.org](https://getgrav.org/downloads/plugins).

You should now have all the plugin files under

/your/site/grav/user/plugins/grav-ray

> NOTE: This plugin is a modular component for Grav which may require other plugins to operate, please see its [blueprints.yaml-file on GitHub](https://github.com/trilbymedia/grav-plugin-grav-ray/blob/main/blueprints.yaml).
### Admin Plugin

If you use the Admin Plugin, you can install the plugin directly by browsing the `Plugins`-menu and clicking on the `Add` button.

## Configuration

Before configuring this plugin, you should copy the `user/plugins/grav-ray/grav-ray.yaml` to `user/config/plugins/grav-ray.yaml` and only edit that copy.

Here is the default configuration and an explanation of available options:

```yaml
enabled: true
host: 'localhost'
port: 23517
```
Note that if you use the Admin Plugin, a file with your configuration named grav-ray.yaml will be saved in the `user/config/plugins/`-folder once the configuration is saved in the Admin.

## Usage

Ray has many powerful methods that can be called via PHP. Check out the full docs for details: https://myray.app/docs/php/vanilla-php/reference

There is a basic Twig integration that you supports the multiple variables, but does not support any of the advanced functionality like labels, colors, images, links, HTML, etc.


```twig
{# Twig function with multiple variables #}
{{ ray(page.header, uri.url) }}
{# Twig filter example #}
{{ page.header|ray }}
```

## Credits

Obviously this plugin would not exists if it wasn't for Spatie's Ray Debugger. Thanks to them for the license I used to test and develop this plugin.


45 changes: 45 additions & 0 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Grav Ray
slug: grav-ray
type: plugin
version: 1.0.0
description: Grav plugin for the Ray debugger app
icon: bug
author:
name: Trilby Media
email: [email protected]
homepage: https://github.com/trilbymedia/grav-plugin-grav-ray
demo: http://demo.yoursite.com
keywords: grav, plugin, etc
bugs: https://github.com/trilbymedia/grav-plugin-grav-ray/issues
docs: https://github.com/trilbymedia/grav-plugin-grav-ray/blob/develop/README.md
license: MIT

dependencies:
- { name: grav, version: '>=1.6.0' }

form:
validation: loose
fields:
enabled:
type: toggle
label: PLUGIN_ADMIN.PLUGIN_STATUS
highlight: 1
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool
host:
type: text
label: Host
help: The host used to communicate with the Ray app
default: 'localhost'

port:
type: number
label: Port
help: The port number used to communicate with the Ray app.
default: 23517
validate:
type: int
25 changes: 25 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "trilbymedia/grav-ray",
"type": "grav-plugin",
"description": "Grav plugin for the Ray debugger app",
"keywords": ["plugin"],
"homepage": "https://github.com/trilbymedia/grav-plugin-grav-ray",
"license": "MIT",
"authors": [
{
"name": "Trilby Media",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": ">=7.1.3",
"spatie/ray": "^1.41"
},
"autoload": {
"psr-4": {
"Grav\\Plugin\\GravRay\\": "classes/"
},
"classmap": ["grav-ray.php"]
}
}
Loading

0 comments on commit b843d38

Please sign in to comment.