function(ContainerInterface $container) { $options = [ 'scheme' => 'tcp', 'host' => $container->has('REDIS_HOST') ? $container->get('REDIS_HOST') : 'redis', 'port' => $container->has('REDIS_PORT') ? $container->get('REDIS_PORT') : 6379 ]; if ($container->has('REDIS_USER')) { $options['username'] = $container->get('REDIS_USER'); } if ($container->has('REDIS_PASSWORD')) { $options['password'] = $container->get('REDIS_PASSWORD'); } return new Predis\Client($options); }, Pheanstalk\Pheanstalk::class => function(ContainerInterface $container) { return Pheanstalk\Pheanstalk::create( $container->get('BEANSTALKD_HOST'), $container->has('BEANSTALKD_PORT') ? $container->get('BEANSTALKD_PORT') : 11300 ); }, Incoviba\Service\MQTT\MQTTInterface::class => function(ContainerInterface $container) { $service = new Incoviba\Service\MQTT($container->get(Psr\Log\LoggerInterface::class)); $service->register('default', $container->get(Incoviba\Service\MQTT\Pheanstalk::class)); return $service; } ];