thiagof / laravelrpc
JsonRPC Client/Server services for Laravel 5
0.2.2
2016-11-03 20:35 UTC
Requires
- php: >=5.4.0
- fguillot/json-rpc: 1.0.*
- illuminate/support: >=5.0
Requires (Dev)
- laravel/laravel: >=5.0
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-11-23 18:34:02 UTC
README
Installation
With composer
composer require thiagof/laravelrpc
Laravel configuration
php artisan config:publish thiagof/laravelrpc
# Laravel > 5.1
php artisan vendor:publish --provider="Thiagof\LaravelRPC\RpcServiceProvider"
Configuration
Include the provider in app/config/app.php
:
'providers' => array(
[...]
'Thiagof\LaravelRPC\RpcServiceProvider',
);
Also include the alias
'providers' => array(
[...]
'Thiagof\LaravelRPC\RpcClientFacade',
'Thiagof\LaravelRPC\RpcServerFacade',
);
Setup your Client/Server properties in your app config/rpc.php
Usage
The Client
<?php
use RpcClient;
$result = RpcClient::myServerMethod();
The Server
<?php
Route::post('rpc', function() {
$server = app('JsonRpcServer');
$server->attach(new MyRpcMethods);
$server->execute();
});
Further underlying API Reference
Please refer to fguillot/json-rpc