wandu / q
This package is abandoned and no longer maintained.
No replacement package was suggested.
Very Simple Queue.
v4.0.0-beta2
2017-07-11 09:07 UTC
Requires
- php: >=7.0
Suggests
- aws/aws-sdk-php: for SQS queue.
- pda/pheanstalk: for Beanstalkd queue.
This package is not auto-updated.
Last update: 2022-03-30 02:02:41 UTC
README
Very Simple Queue.
Installation
composer require wandu/q
Usage
Sender
use Wandu\Q\Adapter\SqsAdapter; use Wandu\Q\Queue; use Wandu\Q\Serializer\JsonSerializer; $sender = new Queue(new JsonSerializer(), new SqsAdapter( 'xxxxxxxxxxxx', // key 'xxxxxxxxxxxx', // secret 'ap-northeast-1', // region 'https://sqs.ap-northeast-1.amazonaws.com/000000000000/queue-name' // queue url )); $sender->enqueue([ 'body' => 'kkk', '333' => 'halelleknflaksdf', ]);
Receiver
use Wandu\Q\Adapter\SqsAdapter; use Wandu\Q\Queue; use Wandu\Q\Serializer\JsonSerializer; $sender = new Queue(new JsonSerializer(), new SqsAdapter( 'xxxxxxxxxxxx', // key 'xxxxxxxxxxxx', // secret 'ap-northeast-1', // region 'https://sqs.ap-northeast-1.amazonaws.com/000000000000/queue-name' // queue url )); while (true) { $job = $sender->dequeue(); if ($job) { print_r($job->read()); $job->delete(); } sleep(3); }