A laravel 4 queue driver using MySQL database, developed for small websites on shared hosting.
Fully functional and 100% native. No special artisan commands for firing jobs required or provided.
queue:listen
, queue:work
and other artisan commands. Add dependency to your composer.json
and run composer update
:
"shamiao/l4mysqlqueue": "~1.0"
Add service provider to configuration value app.providers
in config/app.php
:
'Shamiao\L4mysqlqueue\L4mysqlqueueServiceProvider'
Setup mysql
driver in config/queue.php
:
'default' => 'mysql', // ... or any connection name you like
'mysql' => array(
'driver' => 'mysql',
'queue' => 'default', // Optional
'table' => 'queue', // Optional
),
Run database migrations of this package before using it:
php artisan migrate --package="shamiao/l4mysqlqueue"
queue.connections.<connname>.queue
default
if not specified. queue.connections.<connname>.table
queue
if not specified.Just use queue:listen
and queue:work
artisan commands as Queues page of Laravel Documentations suggests.
On a shared hosting without shell access, consider adding following command to your cron jobs list to fire one job every minute:
* * * * * ( cd /home/username/your/laravel/dir; php artisan queue:work --tries=3; )
composer
or php artisan
console commands.