PHP code example of mrananyan / parrot

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

    

mrananyan / parrot example snippets


$parameters = [
                  'scheme' => 'tcp',
                  'host'   => '127.0.0.1',
                  'port'   => 6379,
              ];

$parameters = [
                  'scheme' => 'unix',
                  'path'   => '/var/run/redis/redis.sock',
              ];

use Parrot\Server\Worker;

$parrotWorker = new Worker($parameters);
$messages = $parrotWorker->subscribe('myChanel');
echo json_encode($messages);

use Parrot\Client\Publisher;

$publisher = new Publisher($parameters);
$publisher->set('myChanel', 'Your message string here');