PHPackages                             moogeek/pheanstalk-worker - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. moogeek/pheanstalk-worker

ActiveLibrary[Queues &amp; Workers](/categories/queues)

moogeek/pheanstalk-worker
=========================

Worker for the Pheanstalk library

0106PHP

Since May 13Pushed 7y ago1 watchersCompare

[ Source](https://github.com/MooGeek/pheanstalk-worker)[ Packagist](https://packagist.org/packages/moogeek/pheanstalk-worker)[ RSS](/packages/moogeek-pheanstalk-worker/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

pheanstalk-worker
=================

[](#pheanstalk-worker)

Pheanstalk is a pure PHP 7.1+ client for the [beanstalkd workqueue](https://beanstalkd.github.io/). It has been actively developed, and used in production by many, since late 2008.

Created by [Gordon Heydon](http://heydon.com.au/), Pheanstalk Worker has ben created as a best of bread worker. Started in Jan 2015 as stable implementation of a worker for [Pheanstalk](https://github.com/pheanstalk/pheanstalk) to either to be used as a proper example of how a worker should be created or as an implementation that can be used in a production system.

**This fork is just a version bump of every dependency plus mild refactoring and refurbishing, at least for now.**

Installation with Composer
--------------------------

[](#installation-with-composer)

Install pheanstalk-worker as a dependency with composer:

```
composer require moogeek/pheanstalk-worker
```

Creating a worker
-----------------

[](#creating-a-worker)

A worker is a process which when runs takes the next job off a set of queues which are being watched and then executes the job with the defined tasks.

The worker process runs the following steps:

1. Watch all registered tubes
2. Reserve the next job
3. Once job is reserved, invoke the registered handler based on the tube name
4. If no exceptions occur, delete the job (success)
5. If 'retry\_on' exceptions occur, call 'release' (retry)
6. If other exception occurs, call 'bury' (error)
7. Repeat steps 2-6

To create a worker use the following example.

```
