1. Go to this page and download the library: Download keystone/queue 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/ */
keystone / queue example snippets
use Keystone\Queue\Message;
class HardMessage implements Message
{
public $name;
public $count;
public function __construct(string $name, int $count)
{
$this->name = $name;
$this->count = $count;
}
public function getKey(): string
{
// The message key is used to determine which queue to publish to.
return 'hard';
}
}
class HardWorker
{
public function process(HardMessage $message)
{
// Do some work to process the message.
}
}
use Keystone\Queue\Publisher;
$publisher = new Publisher(...);
// The message is serialized when publishing and unserialized when consuming
$publisher->publish(new HardMessage('Billy', 12));
use Keystone\Queue\Consumer;
use Keystone\Queue\Provider;
$provider = new Provider(...);
$consumer = new Consumer($provider, ...);
// The consumer will poll the queue for new messages and process them.
$consumer->consume();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.