Download the PHP package websightnl/gearman without Composer
On this page you can find all versions of the php package websightnl/gearman. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download websightnl/gearman
More information about websightnl/gearman
Files in websightnl/gearman
Package gearman
Short Description PHP library for dispatching, handling and managing Gearman Workers
License MIT
Homepage https://github.com/websightnl/gearman
Informations about the package gearman
Gearman
PHP library for dispatching, handling and managing Gearman Workers
Todo: Add support for tasks, only jobs are handled right now.
Todo: Tests are working but could cover more.
Table Of Content
- Requirements
- Installation
- Config
- Bootstrap
- Job example
- Dispatcher usage
- Start workers daemon
- Usage with Supervisor
Requirements
This library uses PHP 5.4+, PECL Gearman and Gearman 1.0+.
Installation
It is recommended that you install the Gearman library through composer. To do so, add the following lines to your composer.json
file.
Config
The library uses a Config class to share configuration between classes.
Example
Example using array
Alternatively, you can setup the config with an array.
Parameters
-
string server
The Gearman Server (E.G. 127.0.0.1:4730). -
array servers
Pool of Gearman Servers. -
string bootstrap
Path to the bootstrap file. -
string class
Fully qualified name of the bootstrap class, the class needs to implement theSinergi\Gearman\BootstrapInterface
interface. -
array __env_variables__
Environment variables you want to send to your bootstrap. -
string user
The user under which the Gearman Workers will run (E.G. apache). -
bool __auto_update
Use for development only__, automatically updates workers before doing a job or task. -
string pidFilename
Change the filename of the created PID file (defaults to gearmanhandler.pid). The file is always created in the system temp path. -
string lockFilename
Change the filename of the created lock file (defaults to gearmanhandler.lock). The file is always created in the system temp path. - int loopTimeout
Change the time (in milliseconds) between pinging the Gearman server. Defaults to the low value of 10 milliseconds, for legacy reasons. Change this value if you experience high load on your Gearman server!
Bootstrap
File /path/to/your/bootstrap.php
Job example
Dispatcher usage
To send tasks and jobs to the Workers, use the Dispatcher like this:
Start workers daemon
Starts the Workers as a daemon. You can use something like supervisor to make sure the Workers are always running. You can use the same parameters as in the config.
Single server
Multiple servers
List of commands
start
stop
restart
Usage with Supervisor
This is an example of a Supervisor configuration. Add it to your Supervisor configuration file (E.G. /etc/supervisord.conf).
All versions of gearman with dependencies
ext-gearman Version *
psr/log Version ~1
react/event-loop Version 0.4.*
symfony/console Version 2.*|3.4.*|4.1.*|5.*