public
Description: PHP client for beanstalkd queue
Homepage:
Clone URL: git://github.com/pda/pheanstalk.git
name age message
file .gitmodules Sun May 31 05:14:29 -0700 2009 Submodulized SimpleTest, tracking master instea... [Paul Annesley]
file LICENCE Mon Oct 13 23:32:59 -0700 2008 Imported intial work in progress to Git reposit... [Paul Annesley]
file README.md Tue Jun 23 05:12:13 -0700 2009 Updated README to include instructions on runni... [Paul Annesley]
directory classes/ Wed Aug 05 09:06:51 -0700 2009 Handle RESPONSE_TIMED_OUT properly in reserve f... [ivan]
directory doc/ Wed Jun 17 04:22:07 -0700 2009 Tidied up documentation. [Paul Annesley]
file pheanstalk_init.php Tue Jun 23 05:04:38 -0700 2009 Added class loader and init script for easier i... [Paul Annesley]
directory tests/ Tue Jun 23 05:04:38 -0700 2009 Added class loader and init script for easier i... [Paul Annesley]
README.md

Pheanstalk

Pheanstalk, created by Paul Annesley, is a pure PHP 5.2+ client for the beanstalkd workqueue. The code is rigorously unit tested and written using encapsulated, maintainable object oriented design.

All commands and responses specified in the protocol documentation for beanstalkd 1.3 are fully supported.

Usage Example


<?php

// register Pheanstalk class loader
require_once('pheanstalk_init.php');

$pheanstalk = new Pheanstalk('127.0.0.1');

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

$pheanstalk
  ->useTube('testtube')
  ->put("job payload goes here\n");

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

$job = $pheanstalk
  ->watch('testtube')
  ->ignore('default')
  ->reserve();

echo $job->getData();

$pheanstalk->delete($job);

?>

Running the tests



# ensure you have simpletest
$ git submodule init
$ git submodule update


$ ./tests/runtests.php
All Tests
OK
Test cases run: 4/4, Passes: 103, Failures: 0, Exceptions: 0


# extra tests relying on a beanstalkd on 127.0.0.1:11300
$ ./tests/runtests.php --with-server
All Tests
OK
Test cases run: 7/7, Passes: 198, Failures: 0, Exceptions: 0


$ ./tests/runtests.php --help

CLI test runner.

Available options:

  --with-server      Includes tests which connect to a beanstalkd server
  --testfile   Only run the specified test file.
  --help             This documentation.