Skip to content

Instantly share code, notes, and snippets.

@eddy8
Created March 14, 2017 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddy8/16a069f0db58ce04ae241339d21a177b to your computer and use it in GitHub Desktop.
Save eddy8/16a069f0db58ce04ae241339d21a177b to your computer and use it in GitHub Desktop.
laravel queue(v5.3) standalone with redis
<?php
use Illuminate\Queue\Capsule\Manager as Queue;
use Illuminate\Redis\Database as Redis;
require 'vendor/autoload.php';
$queue = new Queue;
$app = $queue->getContainer();
$manager = $queue->getQueueManager();
$queue->addConnection([
'driver' => 'redis',
'queue' => 'default',
'connection' => 'default',
'retry_after' => 90,
]);
$app->singleton('redis', function () {
return new Redis([
'cluster' => false,
'default' => [
'host' => '192.168.128.128',
'port' => 6379,
'database' => 0,
],
]);
});
$queue->setAsGlobal();
$queue->push('SendEmail', array('message' => 'message'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment