thiagof / laravelrpc by thiagof

JsonRPC Client/Server services for Laravel 5
7,011
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-11-19 03:11:02
Package Statistics
Total Downloads: 7,011
Monthly Downloads: 113
Daily Downloads: 0
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