PHP code example of kiwfy / taurus-publisher-php
1. Go to this page and download the library: Download kiwfy/taurus-publisher-php 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/ */
kiwfy / taurus-publisher-php example snippets
use TaurusPublisher\TaurusPublisher;
$queue = 'test';
$data = [
'publisher' => 'example',
];
$taurus = new TaurusPublisher();
$result = $taurus->add(
$queue,
$data
);
var_dump($result);
use TaurusPublisher\TaurusPublisher;
$queue = 'test';
$data = [
'publisher' => 'example',
];
$redisConfig = [
'scheme' => 'tcp',
'host' => 'localhost',
'port' => 6379,
];
$taurus = new TaurusPublisher($redisConfig);
$result = $taurus->add(
$queue,
$data
);
var_dump($result);
use TaurusPublisher\TaurusPublisher;
$queue = 'test';
$data = [
'publisher' => 'example',
];
$taurus = new TaurusPublisher();
$queueConfig = [
'attempts' => 4,
'backoff' => 20000,
'delay' => 1,
'removeOnComplete' => 20,
];
$result = $taurus->add(
$queue,
$data,
$queueConfig
);
var_dump($result);
use TaurusPublisher\TaurusPublisher;
use Predis\Client as Redis;
$redisConfig = [
'scheme' => 'tcp',
'host' => 'redis',
'port' => 6379,
];
$client = new Redis($redisConfig);
$queue = 'test';
$data = [
'publisher' => 'example',
];
$taurus = new TaurusPublisher(
$redisConfig,
[],
$client
);
for ($i=0; $i < 1000000; $i++) {
$result = $taurus->add(
$queue,
$data
);
var_dump($result);
}
sh
php sample/publisher-sample.php