$ composer require initx/querabilis
use Initx\Querabilis\Driver\FilesystemQueue;
$queue = new FilesystemQueue('./queue');
use Initx\Querabilis\Envelope;
$envelope = new Envelope('Payload goes here');
$queue->add($envelope);
$envelope = $queue->remove();
$envelope->getPayload(); // "Payload goes here"
- Amazon SQS
- Redis (Predis)
- AMQP
- Beanstalkd
- Filesystem
- In memory
Each driver implements Queue interface.
add(e)
- inserts an element if possible, otherwise throwing exceptionoffer(e)
- inserts an element if possible, otherwise returning false
remove()
- remove and return head of queue, otherwise throwing exceptionpoll()
- remove and return head of queue, otherwise returning null
element()
- return but do not remove head of queue, otherwise throwing exceptionpeek()
- return but do not remove head of queue, otherwise returning null
use Predis\Client;
use Initx\Querabilis\Driver\RedisQueue;
$client = new Client(['host' => '127.0.0.1']);
$queue = new RedisQueue($client, 'queueName');
use Aws\Sqs\SqsClient;
use Initx\Querabilis\Driver\SqsQueue;
$client = new SqsClient(your_sqs_client_config);
$queue = new SqsQueue($client, 'queueName');
use Initx\Querabilis\Driver\InMemoryQueue;
$queue = new InMemoryQueue();
use Pheanstalk\Pheanstalk;
use Initx\Querabilis\Driver\BeanstalkdQueue;
$client = Pheanstalk::create([your_beanstalkd_config]);
$queue = new BeanstalkdQueue($client);
use PhpAmqpLib\Connection\AMQPStreamConnection;
use Initx\Querabilis\Driver\AmqpQueue;
$connection = new AMQPStreamConnection([your_amqp_config]);
$queue = new AmqpQueue($connection, 'queueName', 'exchange');