PHP code example of gitkv / laravel-gearman-rpc

1. Go to this page and download the library: Download gitkv/laravel-gearman-rpc 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/ */

    

gitkv / laravel-gearman-rpc example snippets


'providers' => [
    gitkv\GearmanRpc\GearmanRpcServiceProvider::class
],
'aliases' => [
    'GearmanRpc' => gitkv\GearmanRpc\Facade\GearmanRpc::class,
],



namespace App\Rpc;


use gitkv\GearmanRpc\HandlerContract;

class MyRpcHandler implements HandlerContract {

    public function handle($payload) {
        return [
            'status'  => 'success',
            'payload' => $payload,
        ];
    }

}

'MyExampleFunction' => \App\Rpc\MyRpcHandler::class,


$result = GearmanRpc::doNormal('MyExampleFunction', json_encode(['test'=>'data']));


GearmanRpc::doBackground('MyExampleFunction', json_encode(['test'=>'data']));
bash
php artisan vendor:publish --provider="gitkv\GearmanRpc\GearmanRpcServiceProvider" --tag=config