PHP code example of asheliahut / mock-laravel-app

1. Go to this page and download the library: Download asheliahut/mock-laravel-app library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

asheliahut / mock-laravel-app example snippets


$container['queue'] = static function (ContainerInterface $c): Queue {
    $queue = new Queue();

    // Library is broken - cast some magic to get redis to work
    if ('redis' === $c['settings']['queue']['driver']) {
        $connector = static function () use ($c) {
            $app = new \Asheliahut\MockLaravelApp();
            $redisManager = new Redis($app,'predis', [
                'cluster' => false,
                'default' => $c['settings']['queue'],
            ]);

            return new RedisConnector($redisManager);
        };

        $queue->getQueueManager()->addConnector('redis', $connector);
    }

    $queue->addConnection($c['settings']['queue']);
    $queue->setAsGlobal();

    return $queue;
};