Skip to content

Babacooll/CommandPlanner

Repository files navigation

CommandPlanner

SensioLabsInsight Scrutinizer Code Quality Code Coverage Build Status

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

About

Symfony console command planner (cron)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages