Pheanstalk is a pure PHP 5.3+ 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 release in 2010, a 2.0 release in 2013, and a 3.0 release in 2014.
Pheanstalk 3.0 introduces PHP namespaces, PSR-1 and PSR-2 coding standards, and PSR-4 autoloader standard.
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.
Install pheanstalk as a dependency with composer:
composer require pda/pheanstalk
<?php
// Hopefully you're using Composer autoloading.
use Pheanstalk\Pheanstalk;
$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);
// ----------------------------------------
// check server availability
$pheanstalk->getConnection()->isServiceListening(); // true or false
There is a section of the test suite which depends on a running beanstalkd
at 127.0.0.1:11300, 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 Composer set up
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
# ensure you have PHPUnit
$ composer install --dev
$ ./vendor/bin/phpunit
PHPUnit 4.0.19 by Sebastian Bergmann.
Configuration read from /Users/pda/code/pheanstalk/phpunit.xml.dist
................................................................. 65 / 83 ( 78%)
..................
Time: 239 ms, Memory: 6.00Mb
OK (83 tests, 378 assertions)
- Paul Annesley
- Lachlan Donald
- Joakim Bick
- Vyacheslav
- leprechaun
- Peter McArthur
- robbiehudson
- Geoff Catlin
- Steven Lewis
- Lars Yencken
- Josh Butts
- Henry Smith
- Javier Spagnoletti
- Graham Campbell
- Thomas Tourlourat
- Matthieu Napoli
- Christoph
- James Hamilton
- Hannes Van De Vreken
- Yaniv Davidovitch
- .. more? Let me know if you're missing.
© Paul Annesley
Released under the The MIT License
pheanstalk's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.