thiagof / laravelrpc by thiagof

JsonRPC Client/Server services for Laravel 5
6,088
33
5
Package Data
Maintainer Username: thiagof
Maintainer Contact: thiago@internetbudi.com.br (Thiago Fernandes)
Package Create Date: 2015-03-26
Package Last Update: 2021-02-02
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-04-23 03:01:54
Package Statistics
Total Downloads: 6,088
Monthly Downloads: 111
Daily Downloads: 11
Total Stars: 33
Total Watchers: 5
Total Forks: 12
Total Open Issues: 1

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