cast / lumen-rpc
Lumen RPC server and client classes
v1.4
2020-03-19 18:01 UTC
Requires
- php: >=7.2
- php-amqplib/thumper: ^0.5.0
- symfony/options-resolver: ^2.7|^3.0|^4.3
README
composer require cast/lumen-rpc
Usage
Create config file rpc.php
like this:
<?php return [ 'config' => [ 'my-method', ] ];
Start a server:
Rpc::listen('my-method', function ($msg) { // do work... return $msg['number'] * 2; });
Make some RPC-call from remote:
$res = Rpc::get('my-method', ['number'=>5]); var_dump($res);
Will gets:
int(10)
Make sure you have correct config for RabbitMQ, see it in config/queue.php