works with plain silex-php
- Add symfony console
- PHP 5.3+
- Pimple 2.1+
- Saxulum ClassFinder 1.0+
- Symfony Console 2.3+
- Symfony Finder 2.3+
Through Composer as saxulum/saxulum-console.
$container->register(new ConsoleProvider());
use Pimple\Container;
use Saxulum\Console\Silex\Provider\ConsoleProvider;
$container = new Container();
$container->register(new ConsoleProvider(), array(
'console.cache' => '/path/to/cache'
));
debug == true
: the cache file will be build at each loaddebug == false
: the cache file will be build if not exists, delete it if its out of sync
use Pimple\Container;
use Saxulum\Console\Silex\Provider\ConsoleProvider;
$container = new Container();
$container->register(new ConsoleProvider());
$container['console.commands'] = $container->extend('console.commands', function ($commands) use ($container) {
$command = new SampleCommand;
$command->setContainer($container);
$commands[] = $command;
return $commands;
});
One of their parent classes has to be: Saxulum\Console\Command\AbstractPimpleCommand
$container['console.command.paths'] = $container->extend('console.command.paths', function ($paths) {
$paths[] = __DIR__ . '/../../Command';
return $paths;
});
Run the console
$container['console']->run();
- Dominik Zogg dominik.zogg@gmail.com