Download the PHP package udokmeci/yii2-beanstalk without Composer
On this page you can find all versions of the php package udokmeci/yii2-beanstalk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download udokmeci/yii2-beanstalk
More information about udokmeci/yii2-beanstalk
Files in udokmeci/yii2-beanstalk
Package yii2-beanstalk
Short Description Yii2 Beanstalk Client at the top of Paul Annesley's pheanstalk
License MIT
Homepage https://github.com/udokmeci/yii2-beanstalk
Informations about the package yii2-beanstalk
yii2-beanstalk
Yii2 beanstalkd web and console component which is an interface on the top of pda/pheanstalk. Thanks Paul Annesley for such a complete work.
How to use?
Installation with Composer
Just add the line under require
object in your composer.json
file.
Then run
Configuration
Now add following lines in to your main
and console
configuration file under components
Now add following in to your console
configuration only.
Producing
Now if everything is fine, you can run beandstalkd
and access to controller as
$mixedData
is added on v1.0 for complex usage. Anything else then string
will be send as json
format. So you can sent anything within it suppoted by json
.
Worker
For worker it also has a built in controller which runs an infinite loop and wait for new jobs. Most of the work is done in BeanstalkController
. All you have to do is to create a controller and action like below.
Controller
Create a controller under your commands
folder. Give the name anything you want to it and extend
your controller from udokmeci\yii2beanstalk\BeanstalkController
Example Controller
Running Worker
Running console is the easiest part. Run ./yii Your controller
Controller will tell you, whether there are actions for correspanding tubes or beanstalk server is accessible and which tubes are listening currently. The controller handles with signals. So exit whenever you want, reserved job will not be hanged.
Any forks are welcome.