cast/lumen-rpc

Lumen RPC server and client classes

v1.4 2020-03-19 18:01 UTC

This package is auto-updated.

Last update: 2024-10-20 04:25:30 UTC


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