Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.13 KB

readme.md

File metadata and controls

56 lines (35 loc) · 1.13 KB

CircleCI

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