PHPackages                             treehouselabs/worker-bundle - 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. treehouselabs/worker-bundle

Abandoned → [symfony/messenger](/?search=symfony%2Fmessenger)ArchivedSymfony-bundle[Queues &amp; Workers](/categories/queues)

treehouselabs/worker-bundle
===========================

Adds worker functionality to a Symfony2 project, using Beanstalkd as the message queue

2.0.1(6y ago)1157.6k↓100%8[2 issues](https://github.com/treehouselabs/worker-bundle/issues)[2 PRs](https://github.com/treehouselabs/worker-bundle/pulls)1MITPHPPHP &gt;=7.0

Since Apr 24Pushed 4y ago6 watchersCompare

[ Source](https://github.com/treehouselabs/worker-bundle)[ Packagist](https://packagist.org/packages/treehouselabs/worker-bundle)[ RSS](/packages/treehouselabs-worker-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (5)Versions (9)Used By (1)

Deprecated &amp; archived
=========================

[](#deprecated--archived)

This bundle is no longer maintained. It will still work with Symfony versions `^2.8|^3.0|^4.0` and is archived here to not break existing applications using it. However it will not get maintenance updates or even security fixes.

If you need queue/worker functionality in your project, there are far better solutions right now to look at:

-
-

Previous readme below 👇

---

Worker bundle
=============

[](#worker-bundle)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9a771d581430ef6de16d4654a59ca000799bc90e3a06884430148d60f18f7664/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74726565686f7573656c6162732f776f726b65722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/treehouselabs/worker-bundle)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/83167e81034c3ac79c8b32d2a31c3cedc73573ba8af5da155b26bc3c92c6809a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f74726565686f7573656c6162732f776f726b65722d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/treehouselabs/worker-bundle)[![Coverage Status](https://camo.githubusercontent.com/d8b59834476de3b7f47e0b05094fa9a773823bdf29693f2aa637fbeff02912d0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f74726565686f7573656c6162732f776f726b65722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/treehouselabs/worker-bundle/code-structure)[![Quality Score](https://camo.githubusercontent.com/bbf3795be2b629a2e0489ee85a9a8d56007371a038703f0003b21d738043d0e6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74726565686f7573656c6162732f776f726b65722d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/treehouselabs/worker-bundle)

A Symfony bundle that adds worker functionality to your project, using [Beanstalkd](http://kr.github.io/beanstalkd/) as the message queue.

Installation
------------

[](#installation)

For this process, we assume you have a Beanstalk server up and running.

Install via [Composer](https://getcomposer.org):

```
$ composer require treehouselabs/worker-bundle
```

Enable the bundle:

```
# app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...

            new TreeHouse\WorkerBundle\TreeHouseWorkerBundle(),
        ];

        // ...
    }

    // ...
}
```

Configuration
-------------

[](#configuration)

Define a queue and you're good to go:

```
# app/config/config.yml

tree_house_worker:
  queue:
    server: localhost
```

The bundle also supports the [PheanstalkBundle](https://github.com/armetiz/LeezyPheanstalkBundle), if you're using that:

```
# app/config/config.yml

tree_house_worker:
  pheanstalk: leezy.pheanstalk
```

Basic Usage
-----------

[](#basic-usage)

The bundle creates a [`QueueManager`](/src/TreeHouse/WorkerBundle/QueueManager.php) service, which you can use to manage jobs. The manager has services registered to execute specific tasks, called *executors*. An executor receives a job from the QueueManager and processes it.

### Defining executors

[](#defining-executors)

First you need to register an executor, and tag it as such:

```
# src/AppBundle/Executor/HelloWorldExecutor.php

use TreeHouse\WorkerBundle\Executor\AbstractExecutor;

class HelloWorldExecutor extends AbstractExecutor
{
    public function getName()
    {
        return 'hello.world';
    }

    public function configurePayload(OptionsResolver $resolver)
    {
        $resolver->setRequired(0);
    }

    public function execute(array $payload)
    {
        $name = array_shift($payload);

        # process stuff here, in this example we just print something
        echo 'Hello, ' . $name;

        return true;
    }
}
```

```
# app/config/services.yml
app.executor.hello_world:
  class: AppBundle/Executor/HelloWorldExecutor
  tags:
    - { name: tree_house.worker.executor }
```

### Scheduling jobs

[](#scheduling-jobs)

Now you can add jobs, either via code or using the `worker:schedule` command:

**In your application's code:**

```
$queueManager = $container->get('tree_house.worker.queue_manager');
$queueManager->add('hello.world', ['Peter']);
```

**Using the command:**

```
php app/console worker:schedule hello.world Peter

```

### Working jobs

[](#working-jobs)

A worker can now receive and process these jobs via the console:

```
php app/console worker:run

# prints:
# Working hello.world with payload ["Peter"]
# Hello, Peter
# Completed job in 1ms with result: true

```

You can run workers by adding them to your crontab, creating a [Supervisor](http://supervisord.org) program for it, or whatever your preferred method is.

Documentation
-------------

[](#documentation)

1. [Message queues &amp; workers](/docs/1-introduction.md)
2. [The QueueManager](/docs/2-queue-manager.md)
3. [Executors](/docs/3-executors.md)
4. [Working jobs](/docs/4-working-jobs.md)

Security
--------

[](#security)

If you discover any security related issues, please email instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Peter Kruithof](https://github.com/pkruithof)
- [All Contributors](../../contributors)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~237 days

Recently: every ~369 days

Total

8

Last Release

2370d ago

Major Versions

v1.2.1 → 2.0.02019-01-30

PHP version history (2 changes)v1.0.0PHP &gt;=5.5

2.0.0PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e70c4936c5121b835d48680dcf4bb57d21724c533dd99591e80101e4a25dd6?d=identicon)[pkruithof](/maintainers/pkruithof)

![](https://www.gravatar.com/avatar/aa2b08ed7a87334a1a0b8e302759c3587e4cbea1a1efb08f23d55cd04d1ccfc0?d=identicon)[marcojanssen](/maintainers/marcojanssen)

---

Top Contributors

[![pkruithof](https://avatars.githubusercontent.com/u/330828?v=4)](https://github.com/pkruithof "pkruithof (19 commits)")[![fieg](https://avatars.githubusercontent.com/u/1086908?v=4)](https://github.com/fieg "fieg (10 commits)")[![kamazan](https://avatars.githubusercontent.com/u/6363110?v=4)](https://github.com/kamazan "kamazan (1 commits)")[![mikemeier](https://avatars.githubusercontent.com/u/776406?v=4)](https://github.com/mikemeier "mikemeier (1 commits)")[![tabbi89](https://avatars.githubusercontent.com/u/5837714?v=4)](https://github.com/tabbi89 "tabbi89 (1 commits)")[![vstm](https://avatars.githubusercontent.com/u/1871866?v=4)](https://github.com/vstm "vstm (1 commits)")

---

Tags

beanstalkdworkerbeanstalk

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/treehouselabs-worker-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/treehouselabs-worker-bundle/health.svg)](https://phpackages.com/packages/treehouselabs-worker-bundle)
```

###  Alternatives

[davidpersson/beanstalk

Minimalistic PHP client for beanstalkd.

200321.9k8](/packages/davidpersson-beanstalk)[foxxmd/laravel-elasticbeanstalk-queue-worker

Deploy your Laravel application as a queue worker on AWS ElasticBeanstalk

5493.5k](/packages/foxxmd-laravel-elasticbeanstalk-queue-worker)[xobotyi/beansclient

PHP7.1+ client for beanstalkd work queue with no dependencies

9226.8k](/packages/xobotyi-beansclient)[udokmeci/yii2-beanstalk

Yii2 Beanstalk Client at the top of Paul Annesley's pheanstalk

69125.3k3](/packages/udokmeci-yii2-beanstalk)[pmatseykanets/artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

4482.1k](/packages/pmatseykanets-artisan-beans)[wowo/wowo-queue-bundle

The WowoQueueBundle provides unified method for use queue systems, like Beanstalkd, RabbitMQ, flat files, database driven queues etc.

2228.0k1](/packages/wowo-wowo-queue-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
