razielsd / beanstalk-logger
Log tool for beanstalk
Installs: 1 266
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- pda/pheanstalk: ^3.1
Requires (Dev)
- phpunit/phpunit: >=6.1
This package is not auto-updated.
Last update: 2024-11-10 05:56:37 UTC
README
Debug for beanstalk
How to use
- Type hinting: Pheanstalk -> PheanstalkInterface
- Configure your factory for pheanstalk
<?php
namespace AppBundle\Pheanstalk;
use Pheanstalk\Pheanstalk;
use razielsd\beanstalklogger\DefaultLogger;
use razielsd\beanstalklogger\BeanstalkWrapper;
class BeanstalkFactory
{
public static function factory(string $host, int $port, bool $enableLog)
{
$pheanstalk = new Pheanstalk($host, $port, 1.0, true);
$logger = new DefaultLogger();
$logger->enable($enableLog);
return new PheanstalkWrapper($pheanstalk, $logger);
}
}
Symfony service example
app.pheanstalk:
class: razielsd\beanstalklogger\BeanstalkWrapper
factory: ['AppBundle\Beanstalk\BeanstalkFactory', factory]
arguments: ['%beanstalkd_host%', '%beanstalkd_port%', true]