# LaravelJsonRpc **Repository Path**: maoxuner/laravel-jsonrpc ## Basic Information - **Project Name**: LaravelJsonRpc - **Description**: JSON-RPC 2.0 Server/Client For Laravel - **Primary Language**: PHP - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-07-18 - **Last Updated**: 2025-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # JSON-RPC 2.0 Server/Client For Laravel ## Entrypoint Add route for jsonrpc entrypoint ```php \Illuminate\Support\Facades\Route::post('/jsonrpc', 'maoxuner\LaravelJsonRpc\Server\Server@entrypoint'); ``` ## Configure ```bash php artisan vendor:publish --tags=jsonrpc ``` Do some modification such as changing namespace to `App\\Actions` ## Create a procedure Create a procedure class under the namespace configured before with a public function `handle`. ```bash 'Hello, '.$name.'!', 'foo' => $foo, 'bar' => $bar, ]; } } ``` ## Test Client Use tinker create a client and then call `Ping` procedure. Params are supported by passing param position/name indexed array as second argument to execute. ```bash php artisan tinker ``` ```php $client = new \maoxuner\LaravelJsonRpc\Client\Client(\Illuminate\Support\Facades\Http::baseUrl('http://foo-bar/jsonrpc')); echo $client->execute('Ping'); dump($client->execute('Say', ['World', 'oof'])); dump($client->execute('Say', ['bar' => 'rab', 'name' => 'World'])); ```