Instantly share code, notes, and snippets.

What would you like to do?
A PHP long running process that fires a command at a command bus at regular time intervals
#!/usr/bin/env php
namespace CodeReviewsIo\Worker;
use CodeReviewsIo\Domain\Command\TickTime;
use Prooph\ServiceBus\CommandBus;
use React\EventLoop\Factory;
use Zend\ServiceManager\ServiceManager;
call_user_func(function () {
require_once __DIR__ . '/../vendor/autoload.php';
$servicesConfig = require __DIR__ . '/../config/all-configs-merged-together.php';
$loop = Factory::create();
$tickInterval = 15 * 60;
function () use ($servicesConfig) {
/* @var $commandBus callable */
$commandBus = (new ServiceManager($servicesConfig))
// @TODO this is required, or connections will never be GC'd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment