kerasai / console-command-loader
There is no license information available for the latest version (0.0.1) of this package.
Load services from the container as console commands Symfony.
0.0.1
2020-04-21 00:39 UTC
Requires
- symfony/console: ^4.4
- symfony/dependency-injection: ^4.4
Requires (Dev)
- consolidation/robo: ~1
- drupal/coder: ^8.3
- kerasai/robo-phpcs: ^0.0.4
This package is auto-updated.
Last update: 2025-04-21 22:55:30 UTC
README
This package adds the functionality to use services tagged as commands within a Symfony console application.
Usage
Set the "console.command" tag onto the service, and add a "command" value.
services: command.compute: class: \Kerasai\MyApp\Command\MyCommand public: true tags: - { name: 'console.command', command: 'my-command' }
And in the code that bootstraps the console application, create the service container and set the command loader.
<?php use Kerasai\ConsoleCommandLoader\TaggedCommandLoader; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; $containerBuilder = new ContainerBuilder(); $loader = new YamlFileLoader($containerBuilder, new FileLocator(__DIR__)); $loader->load('services.yml'); $commandLoader = new TaggedCommandLoader($containerBuilder); $app->setCommandLoader($commandLoader); $app->run();