PHPackages                             mle86/wq-beanstalkd - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mle86/wq-beanstalkd

ActiveLibrary

mle86/wq-beanstalkd
===================

A Beanstalkd module for mle86/wq using the pda/pheanstalk connector

v1.0.3(5y ago)020MITPHPPHP &gt;=7.1CI failing

Since May 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mle86/php-wq-beanstalkd)[ Packagist](https://packagist.org/packages/mle86/wq-beanstalkd)[ RSS](/packages/mle86-wq-beanstalkd/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (11)Used By (0)

WQ-Beanstalkd (`mle86/wq-beanstalkd`)
=====================================

[](#wq-beanstalkd--mle86wq-beanstalkd)

This package contains the PHP class `mle86\WQ\WorkServerAdapter\BeanstalkdWorkServer`.

It supplements the [**mle86/wq**](https://github.com/mle86/php-wq) package by implementing its `WorkServerAdapter` interface.

It connects to a Beanstalkd server using the [pda/pheanstalk](https://github.com/pda/pheanstalk) package by Paul Annesley.

Version and Compatibility
=========================

[](#version-and-compatibility)

This is **version 1.0.2**of `mle86/wq-beanstalkd`.

It was developed for version 1.0.0 of `mle86/wq`and should be compatible with all of its future 1.x versions as well.

Installation and Dependencies
=============================

[](#installation-and-dependencies)

```
$ composer require mle86/wq-beanstalkd

```

It requires PHP 7.1, [mle86/wq](https://github.com/mle86/php-wq), and [pda/pheanstalk](https://github.com/pda/pheanstalk).

Class reference
===============

[](#class-reference)

`class mle86\WQ\WorkServerAdapter\BeanstalkdWorkServer implements WorkServerAdapter`

`getNextQueueEntry()` uses the `RESERVE` command, `buryEntry()` uses the `BURY` command, `storeJob()` and `requeueEntry()` use the `PUT` command, and `deleteEntry()` uses the `DELETE` command.

*Work Queues* are Beanstalkd's “tubes”.

- `public function __construct (Pheanstalk $pheanstalk)`
    Constructor. Takes an already-configured `Pheanstalk` instance to work with. Does not attempt to establish a connection itself – use the `connect()` factory method for that instead.
- `public static function connect (string $host = "localhost", int $port = PheanstalkInterface::DEFAULT_PORT, int $connectTimeout = null)`
    Factory method. See [Pheanstalk::\_\_construct](https://github.com/pda/pheanstalk/blob/master/src/Pheanstalk.php)for the parameter descriptions.

Interface methods which are documented in the [`WorkServerAdapter`](https://github.com/mle86/php-wq/blob/master/doc/Ref_WorkServerAdapter_interface.md) interface:

- `public function storeJob (string $workQueue, Job $job, int $delay = 0)`
- `public function getNextQueueEntry ($workQueue, int $timeout = DEFAULT_TIMEOUT) : ?QueueEntry`
- `public function buryEntry (QueueEntry $entry)`
- `public function requeueEntry (QueueEntry $entry, int $delay, string $workQueue = null)`
- `public function deleteEntry (QueueEntry $entry)`

Usage example
=============

[](#usage-example)

```
