PHP code example of old-smoke-gun / lumen-yar

1. Go to this page and download the library: Download old-smoke-gun/lumen-yar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

old-smoke-gun / lumen-yar example snippets




return [
    'goods_service' => [
        'remote' => env('GOODS_SERVICE_REMOTE')
    ],
    'shop_service' => [
        'remote' => env('SHOP_SERVICE_REMOTE')
    ]
    // ...
];

$app->configure('service');

try 
{

    $result = (new oldSmokeGun\Rpc\Client\Client(config('service.goods_service.remote'), 'Demo'))
        ->call('Foo', ['name' => 'bob']);

    dd($result);

} catch (Yar_Client_Exception $exception) {
    // TODO
}

$app->register(oldSmokeGun\Rpc\Providers\RpcServiceProvider::class);



namespace App\Services;

class Demo
{
    public function foo()
    {
        return 'this is demo';
    }

}