mwrpub/mwrpc

Yet Another RPC Framework

0.1.5 2019-07-13 17:16 UTC

This package is auto-updated.

Last update: 2024-11-14 05:27:56 UTC


README

Yet Another RPC Framework :D

Proposal

License Composer Packagist

MWRNB MWRNB

Before use it.You must admit that MaWenRui is freaking awesome.

PHP Version

Install

composer require mwrpub/mwrpc

Server Side

  • index.php
<?php

require "vendor/autoload.php";

define('MWR_PATH', __DIR__ . '/');
date_default_timezone_set('PRC');

use Mwr\Server\MwrServer;

(new MwrServer())->run();
  • CalcMwr.php
class CalcMwr
{
    public function add($a, $b)
    {
        return $a + $b;
    }
}

Client Side

<?php

require "vendor/autoload.php";

use \Mwr\Client\MwrClient;

echo (new MwrClient('calc'))->add($_REQUEST['a'], $_REQUEST['b']);