juwai / laravel-http-rpc
Laravel package for http rpc client
Installs: 3 581
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ~6.0
Suggests
- barryvdh/laravel-debugbar: Required to display RPC connection information on Debugbar (2.4.*).
This package is auto-updated.
Last update: 2025-01-08 22:48:26 UTC
README
This package provides an easy way of connecting to HTTP RPC.
Installation
-
Add facade and providers to
config/app.php
'aliases' => [ ... 'HTTPRPC' => Juwai\LaravelHTTPRPC\Facades\HTTPRPC::class, ],
'providers' => [ ... Juwai\LaravelHTTPRPC\Providers\HTTPRPCClientProvider::class, ],
-
Publish config file:
$ php artisan vendor:publish
-
Add real service configuration to the published config file
config/httprpc.php
.
Usage
GET method
$client = HTTPRPC::get('service_one', '1.0'); $response = $client->service_function($param1, $param2);
POST method
$client = HTTPRPC::get('service_one', '1.0', 2000, 'POST'); $response = $client->service_function(['param1' => $param1, 'param2' => $param2]);
Connection monitor
If you installed Debugbar the RPC connection information shows on Debugbar panels.