CommandPlanner is a cron management for Symfony Console component commands.
CommandPlanner is available through composer :
$ php composer.phar require babacooll/command-planner ~0.0.1
You can load method in CommandPlanner by two ways :
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();
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.
- Unit testing
- Exception handler