babacooll / command-planner
Command cron planner
v0.0.1
2015-04-28 17:53 UTC
Requires
- mtdowling/cron-expression: ~1.0
- psr/log: ~1.0
- symfony/config: ~2.6
- symfony/console: ~2.6
- symfony/event-dispatcher: ~2.6
- symfony/process: ~2.6
Requires (Dev)
- phpunit/phpunit: ~4.6
This package is auto-updated.
Last update: 2024-12-12 04:29:43 UTC
README
CommandPlanner is a cron management for Symfony Console component commands.
Installation
CommandPlanner is available through composer :
$ php composer.phar require babacooll/command-planner ~0.0.1
Usage
You can load method in CommandPlanner by two ways :
Example inline
PHP File :
<?php require('vendor/autoload.php'); use CommandPlanner\CommandPlanner; $commandPlanner = new CommandPlanner(); $commandPlanner->add( new \CommandPlanner\Wrapper\CommandWrapper( 'CommandPlanner\Tests\Data\TestCommand', 'Symfony\Component\Console\Application', \Cron\CronExpression::factory('* * * * *'), [ 'parameters' => ['test'], 'log_file' => 'test.log', 'options' => [] ] ) ); $commandPlanner->run();
Example from config
PHP File :
<?php require('vendor/autoload.php'); use CommandPlanner\CommandPlanner; $commandPlanner = new CommandPlanner(); $commandPlanner->addCommandsFromConfig('config/config.yml'); $commandPlanner->run();
Config File :
command_planner: commands: my_first_command: namespace : CommandPlanner\Tests\Data\TestCommand timing: '* * * * * *' parameters: ['test'] options: ['--yell'] log_file: test.log application: Symfony\Component\Console\Application
These examples use CommandPlanner\Tests\Data\TestCommand test command from this package.
TODO
- Unit testing
- Exception handler