Gearman JobServer implementation for Laravel
Gearman is a MQ (Message Queue) provider with foreground and background capabilities. This makes it one of the few PHP-suited synchronous MQ handlers.
Laravel is on of the leanest and meanest PHP Frameworks around - perfectly suited for rest API projects.
The Jobserver package is a Gearman dispatch implementation for Laravel. The package functions as an abstraction layer to send both foreground as background jobs to a MQ server (Gearman in this case). The Jobserver package is taylored to use in the 3-layer structure (app <-> api <-> worker).
Read more about installing and using the jobserver package here:
3-Layer - Set up Message Queueing
Add the package to your API dependencies. To use the local "synced" mode - skipping a local Gearman installation - add the models/Ghostjob.php file to your worker app/models directory. To make the synced connection between the API and worker job function work, add "echo Ghostjob::evaluate ('controllerDispatch', $argv);" to the end of the required function files.
Add the Jobserver package to the composer requirements of your API project. In project/composer.json
, add the koenbetsens/jobserver
entry