Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pafelin/laravel-gearman
register gearmand queue manager for laravel
https://github.com/pafelin/laravel-gearman
gearman laravel php queue
Last synced: about 12 hours ago
JSON representation
register gearmand queue manager for laravel
- Host: GitHub
- URL: https://github.com/pafelin/laravel-gearman
- Owner: pafelin
- Created: 2013-09-13T12:03:34.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2020-11-27T02:22:45.000Z (almost 4 years ago)
- Last Synced: 2024-06-19T23:15:38.778Z (5 months ago)
- Topics: gearman, laravel, php, queue
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 63
- Watchers: 7
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Description
This package gives you the possibily to add gearman as native queue back-end service
#Installation
first you need to add it to your composer.json
second, in `config/app.php`, you need to comment out the native queue service provider
//'Illuminate\Queue\QueueServiceProvider',
and to put this instead:
'Pafelin\Gearman\GearmanServiceProvider',
Then in your config/queue.php file you can add:
'default' => 'gearman',
'connections' => array(
'gearman' => array(
'driver' => 'gearman',
'host' => 'localserver.6min.local',
'queue' => 'default',
'port' => 4730,
'timeout' => 1000 //milliseconds
)
)or, if you have multiple gearman servers:
'default' => 'gearman',
'connections' => array(
'gearman' => array(
'driver' => 'gearman',
'hosts' => array(
array('host' => 'localserver.6min.local', 'port' => 4730),
array('host' => 'localserver2.6min.local', 'port' => 4730),
),
'queue' => 'default',
'timeout' => 1000 //milliseconds
)
)Then in your code you can add code as (this is the native way to add jobs to the queue):
Queue::push('SomeClass', array('message' => 'The data that should be available in the SomeClass@fire method'));
Small hint, you can call Namespaced classes and everything that is written in the docs of laravel for calling custom methods is valid here, too.
# Example:
I add a "service" folder to my app folder and inside I create a file "SendMail.php"
The code of the class is here:'Message №' . $row));
}
});Finally I just run on my console:
php artisan queue:listen
And I go to check what's on my email
#Bugs
Please if you notice a bug open an issue or submit request.
Hope this package will help you