-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in example of using the mock laravel app
- Loading branch information
1 parent
b06d223
commit 8028e0f
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
# Mock Laravel App | ||
|
||
Have you ever wanted to use updated 5.6+ laravel components in your Slim or other php framework applications? Now you can just inject this mock container in and you will be able to do everything you want. | ||
|
||
``` | ||
$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; | ||
}; | ||
``` |