Looking to hire Laravel developers? Try LaraJobs

laravel-http-rpc maintained by juwai

Description
Laravel package for http rpc client
Author
Last update
2019/05/08 11:41 (dev-master)
License
Links
Downloads
3 815

Comments
comments powered by Disqus

laravel-http-rpc

This package provides an easy way of connecting to HTTP RPC.

Installation

  1. Add facade and providers to config/app.php

    'aliases' => [
        ...
        'HTTPRPC' => Juwai\LaravelHTTPRPC\Facades\HTTPRPC::class,
    ],
    
    'providers' => [
        ...
        Juwai\LaravelHTTPRPC\Providers\HTTPRPCClientProvider::class,
    ],
    
  2. Publish config file:

    $ php artisan vendor:publish
    
  3. 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.