pyrowman / pheanstalk-bundle
The PheanstalkBundle is a Symfony2 Bundle that provides a command line interface for manage the evqueue workqueue server & a pheanstalk integration.
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.1
- psr/log: ~1.0
- pyrowman/pheanstalk: ~1.0
- symfony/console: ~2.5|~3.0|^4.0
- symfony/framework-bundle: ~2.5|~3.0|^4.0
Requires (Dev)
This package is auto-updated.
Last update: 2025-03-01 00:43:27 UTC
README
EvQueue workqueue clients for Symfony3.
The Pyrowman\PheanstalkBundle is a fork from LeezyPheanstalkBundle
The Pyrowman\PheanstalkBundle is a Symfony3 Bundle that provides a pheanstalk integration with the following features:
- Command Line Interface for manage the queues.
- An integration to the Symfony3 event system.
- An integration to the Symfony3 profiler system to monitor your evqueue server.
- An integration to the Symfony3 logger system.
- A proxy system to customize the command features.
- Auto-wiring:
PheanstalkInterface
Documentation :
Usage example
<?php namespace Acme\DemoBundle\Controller; use Pheanstalk\Structure\Schedule; use Pheanstalk\Structure\TimeSchedule; use Pyrowman\PheanstalkBundle\Proxy\PheanstalkProxy; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\DependencyInjection\ContainerInterface; class HomeController extends AbstractController { public function indexAction() { $sc = $this->get('service_container'); /** @var PheanstalkProxy $pheanstalk */ $pheanstalk = $sc->get("pheanstalk"); // Create a simple Worflow with one task inside $workflow = $pheanstalk->createTask('Sleep', 'Test', '/bin/sleep 80'); // Put the job into instance execution $pheanstalk->put($workflow); // ---------------------------------------- // check server availability $pheanstalk->getConnection()->isServiceListening(); // true or false //----------------------------------------- // Add a scheduler for the job (by default in continous) $schedule = new Schedule($workflow->getId(), new TimeSchedule()); $workflowSchedule = $pheanstalk->createSchedule($schedule); //----------------------------------------- // Edit a workflow $workflow->setGroup('2nd test group'); $pheanstalk->update($workflow); //----------------------------------------- // Getting infos on the execution of a workflow $workflowInstances = $pheanstalk->getWorkflowInstances($workflow); //----------------------------------------- // Delete a job if ($workflow = $pheanstalk->workflowExists('Sleep')) $pheanstalk->delete($workflow); } public static function getSubscribedServices() { return array_merge(parent::getSubscribedServices(), [ // ... 'service_container' => ContainerInterface::class, ]); } } ?>
Testing
# ensure you have Composer set up $ wget http://getcomposer.org/composer.phar $ php composer.phar install $ bin/phpunit PHPUnit 7.1.2 by Sebastian Bergmann and contributors. .......................................................... 58 / 58 (100%) Time: 11.36 seconds, Memory: 16.00 MB OK (58 tests, 98 assertions) Generating code coverage report in HTML format ... done
License
This bundle is under the MIT license. See the complete license.
Credits
Author - Valentin Corre
Original library Author - Thomas Tourlourat
Contributor :
- Peter Kruithof : Version 3
- Maxwell2022 : Symfony2 Profiler integration