Download the PHP package katsana/minions without Composer
On this page you can find all versions of the php package katsana/minions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package minions
JSON-RPC Communication for Laravel
- Installation
- Setup
- Setting Project ID
- Configure Projects
- Request Handler
- Registering the route
- Checking authorization
- Validating the request
- Making a Request
- Running the RPC Server
Installation
Minions can be installed via composer:
Setup
The package will automatically register a service provider.
Next, you need to publish the Minions configuration file:
Setting Project ID
Each project need to have a unique Project ID to be used to identify authorized RPC requests. You can set the project ID on config/minions.php
configuration file:
Configure Projects
Next, you need to setup the project clients and servers information:
endpoint
is only required for configurating server project connection from a client project. A server will never send request to a client project.- Each project should have a pair of unique
token
andsecret
, this will be shared only by the client and server as a form of message verification.
Security
token
is used as an Authorization
bearer token header for the request and signature
is used to sign the message sent via the request.
For projects running on private intranet you may skip setting up
token
andsignature
by setting the value tonull
.
Request Handler
To receive a request from a client, first we need to create a request handler on the server, for example let say we want to create a Add
request.
You can use
php artisan minions:make MathAdd
to generate the base stub fileApp\JsonRpc\MathAdd
.
Registering the route
To register the route, all you need to do is add the request handler to routes/rpc.php
:
You can run the following command to stub routes/rpc.php
:
Checking authorization
You can check whether the project is authorized to use the request by overriding the authorize()
method.
Validating the request
You can validate the request using Laravel Validation. Minions also introduce Minions\Http\ValidatesRequests
trait which you can import and expose validate()
and validateWith()
method. e.g:
Making a Request
To make a request, you can create the following code:
Running the RPC Server
To run Minions RPC Server, you have two options:
- ReactPHP RPC Server using katsana/minions-server
- Laravel Routing (Polyfill) RPC Server using katsana/minions-polyfill
Please go through each option documentation for installation and usages guide.
All versions of minions with dependencies
clue/buzz-react Version ^2.5
datto/json-rpc Version ^6.0
illuminate/database Version ^6.0 || ^7.0 || ^8.0
illuminate/pipeline Version ^6.0 || ^7.0 || ^8.0
illuminate/validation Version ^6.0 || ^7.0 || ^8.0
laravie/codex-security Version ^1.0
laravie/stream Version ^1.3
nyholm/psr7 Version ^1.2
orchestra/canvas-core Version ^4.7 || ^5.0 || ^6.0
react/event-loop Version ^1.1
react/promise Version ^2.5
symfony/psr-http-message-bridge Version ^1.3 || ^2.0