PHP code example of nfarring / redisrpc
1. Go to this page and download the library: Download nfarring/redisrpc 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/ */
nfarring / redisrpc example snippets
$redis_server = new Predis\Client();
$message_queue = 'calc';
$calculator = new RedisRPC\Client($redis_server, $message_queue);
$calculator->clr();
$calculator->add(5);
$calculator->sub(3);
$calculator->mul(4);
$calculator->div(2);
assert($calculator->val() == 4);
$redis_server = new Predis\Client();
$message_queue = 'calc';
$local_object = new Calculator();
$server = new RedisRPC\Server($redis_server, $message_queue, $local_object);
$server->run();