huangdijia / laravel-jsonrpc
jsonrpc for laravel
Installs: 1 213
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.3
- illuminate/http: ^7.0|^8.0
- illuminate/support: ^7.0|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- laravel/framework: ^7.0|^8.0
- phpstan/phpstan: ^0.12
README
Installation
composer require huangdijia/laravel-jsonrpc
Usage
As Server
Controller
use Huangdijia\JsonRpc\Traits\JsonRpcServer; class ExampleController extends Controller { use JsonRpcServer; public function action() { return 'hello, json-rpc'; } }
Route
Route::middleware([Huangdijia\JsonRpc\Middleware\JsonRpcMiddleware::class])->group(function() { Route::post('/example', ExampleController::class); });
As Client
$client = new Huangdijia\JsonRpc\Client($url); $result = $client->action(); // hello, json-rpc