PHP code example of mwrpub / mwrpc

1. Go to this page and download the library: Download mwrpub/mwrpc 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/ */

    

mwrpub / mwrpc example snippets




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

use Mwr\Server\MwrServer;

(new MwrServer())->run();

class CalcMwr
{
    public function add($a, $b)
    {
        return $a + $b;
    }
}



Mwr\Client\MwrClient;

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