* @source https://github.com/illuminate/queue
 * @see http://safeerahmed.uk/illuminate-queues-everywhere-laravel-4-queues-component
 */
$app = new \Slim\Slim();
$app->add(new \Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware());
date_default_timezone_set('UTC');
// BOOTSTRAP-------------------------------------------------------------------
$queue = new Queue();
// Make this Capsule instance available globally via static methods... (optional)
$queue->setAsGlobal();
$queue->getContainer()->bind('encrypter', function () {
    return new Illuminate\Encryption\Encrypter('foobar');
});
// END BOOTSTRAP---------------------------------------------------------------
$app->get('/sync', function () use($queue) {
    $queue->addConnection(['driver' => 'sync']);
    Queue::push('doThing', array('string' => 'sync-' . date('r')));
    echo 'Pushed an instance of doThing to sync driver.';
});
$app->get('/ironio/add', function () use($queue) {
    $queue->getContainer()->bind('request', function () {
        return new Illuminate\Http\Request();
    });
    $queue->getContainer()->bind('IronMQ', function () {
        return new IronMQ();
    });
    $queue->addConnection(['driver' => 'iron', 'project' => 'your-project-id', 'token' => 'your-token', 'queue' => 'illuminate-test', 'encrypt' => true]);
    Queue::push('doThing', array('string' => 'iron-' . date('r')));
    echo 'Pushed an instance of doThing to iron.io.';
});
$app->get('/ironio/work/worker', function () use($queue) {
<?php

require_once __DIR__ . "/vendor/autoload.php";
use Illuminate\Http\Request;
use Illuminate\Queue\Capsule\Manager as Capsule;
use Orlissenberg\Queue\Connectors\ZendJobQueueConnector;
$capsule = new Capsule();
/** @var \Illuminate\Queue\QueueManager $manager */
$manager = $capsule->getQueueManager();
$app = $capsule->getContainer();
$app->bind("encrypter", function () {
    return new Illuminate\Encryption\Encrypter("test");
});
$app->bind("request", function () {
    return Request::createFromGlobals();
});
// Add a new connector
$manager->extend("zendserver", function () use($app) {
    return new ZendJobQueueConnector($app['encrypter'], $app['request']);
});
// Add a connection by the name of "zend"
$capsule->addConnection(['driver' => 'zendserver', 'options' => [], 'callback-url' => 'http://jobqueue.dev/tests/receive.php'], 'zend');
// A driver requires configuration?
$capsule->setAsGlobal();