thiagof / laravelrpc by thiagof

JsonRPC Client/Server services for Laravel 5
6,946
33
5
Package Data
Maintainer Username: thiagof
Maintainer Contact: thiago@internetbudi.com.br (Thiago Fernandes)
Package Create Date: 2015-03-26
Package Last Update: 2024-09-18
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-10-27 15:11:01
Package Statistics
Total Downloads: 6,946
Monthly Downloads: 199
Daily Downloads: 8
Total Stars: 33
Total Watchers: 5
Total Forks: 12
Total Open Issues: 0

CircleCI

Installation

# composer
composer require thiagof/laravelrpc

# laravel config
php artisan config:publish thiagof/laravelrpc
# Laravel > 5.1
php artisan vendor:publish --provider="Thiagof\LaravelRPC\RpcServiceProvider"

Configuration

# app/config/app.php
# include the provider
'providers' => array(
    [...]
    'Thiagof\LaravelRPC\RpcServiceProvider',
);

# 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

use RpcClient;
$result = RpcClient::myServerMethod();

The Server

Route::post('rpc', function() {
  $server = app('JsonRpcServer');
  $server->attach(new MyRpcMethods);
  $server->execute();
});

Further underlying API Reference

Please refer to fguillot/json-rpc