for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Equip\Queue\Driver;
use Pheanstalk\Job;
use Pheanstalk\Pheanstalk;
class BeanstalkDriver implements DriverInterface
{
/**
* @var Pheanstalk
*/
private $beanstalk;
* @param Pheanstalk $beanstalk
public function __construct(Pheanstalk $beanstalk)
$this->beanstalk = $beanstalk;
}
* @inheritdoc
public function enqueue($queue, $command)
return (boolean) $this->beanstalk
->useTube($queue)
->put(serialize($command));
public function dequeue($queue)
$job = $this->beanstalk
->watch($queue)
->ignore('default')
->reserve(static::TIMEOUT);
$data = $job instanceof Job ? $job->getData() : $job;
return [
unserialize($data),
$job,
];
public function processed($job)
return (boolean) $this->beanstalk->delete($job);