RoadRunner Plugin Template

Total alerts All releases

Installation

To use this plugin with RoadRunner you will need to fork or clone your own copy of the RoadRunner binary.

You can import the plugin via go modules:

go get github.com/peterfox/roadrunner-plugin-demo

From there you can edit the plugins.go file to import the plugin.

package container

import (
    // ...
    demoPlugin "github.com/peterfox/roadrunner-plugin-demo"
    // ...
)

// 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.

plugin:
  value: foobar

Usage

To make use of this plugin via PHP you must install the Spiral Goridge library.

You can use the following code as an example in php:

<?php

use Spiral\Goridge\RPC\RPC;
use Spiral\RoadRunner\Environment;

$rpc = RPC::create(Environment::fromGlobals()->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.

go test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.