PHP code example of asyncphp / remit

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

    

asyncphp / remit example snippets


use AsyncPHP\Remit\Client\ZeroMqClient;
use AsyncPHP\Remit\Client\ZeroMqServer;
use AsyncPHP\Remit\Location\InMemoryLocation;

$server = new ZeroMqServer(new InMemoryLocation("127.0.0.1", 5555));

$server->addListener("my-event", function($param1, $param2) {
    // ...do a thing
});

$client = new ZeroMqClient(new InMemoryLocation("127.0.0.1", 5555));

$this->client->emit("my-event", array("foo", "bar"));