Skip to content
This repository

PHP client for beanstalkd queue

branch: master


Build Status

Pheanstalk is a pure PHP 5.2+ client for the beanstalkd workqueue. It has been actively developed, and used in production by many, since late 2008.

Created by Paul Annesley, Pheanstalk is rigorously unit tested and written using encapsulated, maintainable object oriented design. Community feedback, bug reports and patches has led to a stable 1.0.0 release in 2010, and a 2.0.0 release in 2013.

beanstalkd up to the latest version 1.4 is supported. All commands and responses specified in the protocol documentation for beanstalkd 1.3 are implemented.

Installation with Composer

Declare pheanstalk as a dependency in your projects composer.json file:

  "require": {
    "pda/pheanstalk": "$VERSION"

Replace $VERSION with one of the stable versions available on Packagist or 2.*@dev to get the current development version for the 2.x Pheanstalk API.

Usage Example


// If you aren't using composer, register Pheanstalk class loader

$pheanstalk = new Pheanstalk_Pheanstalk('');

// ----------------------------------------
// producer (queues jobs)

  ->put("job payload goes here\n");

// ----------------------------------------
// worker (performs jobs)

$job = $pheanstalk

echo $job->getData();


// ----------------------------------------
// check server availability

$pheanstalk->getConnection()->isServiceListening(); // true or false

Running the tests

There is a section of the test suite which depends on a running beanstalkd at, which was previously opt-in via --with-server. Since porting to PHPUnit, all tests are run at once. Feel free to submit a pull request to rectify this.

# ensure you have PHPUnit
$ sudo pear channel-discover
$ sudo pear channel-discover
$ sudo pear channel-discover
$ sudo pear install phpunit/PHPUnit
$ hash -r

# ensure you have Composer set up
$ wget
$ php composer.phar install

$ phpunit
PHPUnit 3.7.10 by Sebastian Bergmann.

Configuration read from /Users/pda/code/pheanstalk/phpunit.xml.dist

................................................................. 65 / 79 ( 82%)

Time: 0 seconds, Memory: 8.75Mb

OK (79 tests, 387 assertions)



© Paul Annesley

Released under the The MIT License

Something went wrong with that request. Please try again.