Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peterfox/roadrunner-plugin-template
Template project for a RoadRunner plugin
https://github.com/peterfox/roadrunner-plugin-template
Last synced: 5 days ago
JSON representation
Template project for a RoadRunner plugin
- Host: GitHub
- URL: https://github.com/peterfox/roadrunner-plugin-template
- Owner: peterfox
- License: mit
- Created: 2021-08-07T23:03:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-08-30T08:33:47.000Z (about 3 years ago)
- Last Synced: 2024-10-12T11:34:36.569Z (about 1 month ago)
- Language: Go
- Size: 37.1 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# RoadRunner Plugin Template
This repo can be used to scaffold a RoadRunner Plugin. Follow these steps to get started:
1. Update the module name in go.mod
```
module github.com/peterfox/roadrunner-plugin-template
```
2. Ideally you should rename the package in all the `.go` files from `plugin` to something else.```go
package plugin
```
3. Rename the plugin to whatever is appropriate, this should be kept to snake case:
```go
const PluginName = "plugin"
```
4. Update the LICENSE.md file
5. If your plugin is not going to be public on GitHub then you should remove `.github/workflows/codeql-analysis.yml`. You may also need to [enable code scanning](https://docs.github.com/en/code-security/secure-coding/automatically-scanning-your-code-for-vulnerabilities-and-errors/about-code-scanning) for the repository
6. Update the contributors in the README.md.
7. Update the README.md references to the plugin, installation and usage.
8. Update the badges at the top of README.md to point to your own repository.
9. Update the .github/FUNDING.yml file.
10. Remove the todo section from your README.md## Installation
To use this plugin with RoadRunner you will need to fork or clone your
own copy of the [RoadRunner binary](https://github.com/spiral/roadrunner-binary).You can import the plugin via go modules:
```sh
go get github.com/peterfox/roadrunner-plugin-demo
```From there you can edit the [plugins.go](https://github.com/spiral/roadrunner-binary/blob/stable/internal/container/plugins.go) file to
import the plugin.```go
package containerimport (
// ...
demoPlugin "github.com/peterfox/roadrunner-plugin-template"
// ...
)// Plugins returns active plugins for the endure container. Feel free to add or remove any plugins.
func Plugins() []interface{} {
return []interface{}{
// ...
&demoPlugin.Plugin{},
// ...
}
}```
By importing this plugin and registering it the plugin will be compiled into the final binary.
The plugin will require that the _.rr.yaml_ config has the key `plugin` for the plugin won't initialise with roadrunner.
```yaml
plugin:
value: foobar
```## Usage
To make use of this plugin via PHP you must install the [Spiral Goridge](https://github.com/spiral/goridge-php) library.
You can use the following code as an example in php:
```php
getRPCAddress());// returns ['message' => 'test']
$output = $rpc->call('plugin.Message', ['message' => 'test']);
```## Testing
You may download the project and test the plugin using the following command.
```bash
go test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Peter Fox](https://github.com/peterfox)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.