akmaks / command-chaining-bundle
Bundle provides some functional for calling console commands in chain
Installs: 23
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Type:symfony-bundle
Requires
- php: >=7.2.5
- ext-ctype: *
- ext-iconv: *
- phpunit/phpunit: ^9.5
- symfony/console: 5.2.*
- symfony/dotenv: 5.2.*
- symfony/expression-language: 5.2.*
- symfony/flex: ^1.3.1
- symfony/framework-bundle: 5.2.*
- symfony/monolog-bundle: ^3.7
- symfony/yaml: 5.2.*
This package is auto-updated.
Last update: 2024-12-26 06:42:04 UTC
README
Bundle provides some functional for calling console commands in chain
Installation
- Install package
composer require akmaks/command-chaining-bundle
- Create file config/packages/akmaks_command_chaining.yaml and configure your chains
parameters:
chains:
App\UI\Console\FirstMainCommand:
- App\UI\ConsoleSecondCommand
- App\UI\ConsoleThirdCommand
- App\UI\ConsoleSecondCommand
App\UI\Console\SecondMainCommand:
- App\UI\ConsoleSecondCommand
- App\UI\ConsoleThirdCommand
- App\UI\ConsoleSecondCommand
- Implements CommandChainingInterface in chain commands
For master commands:
class CreateCommand extends Command implements CommandChainingInterface
...
public function isMasterCommand(): bool
{
return true;
}
For chain commands:
class ConsoleSecondCommand extends Command implements CommandChainingInterface
...
public function isMasterCommand(): bool
{
return false;
}
...
- Check result:
bin/console app:first:main
[2021-05-25 21:07:25]: app:first:main is a master command of a command chain that has registered member commands
[2021-05-25 21:07:25]: app:first:second, app:first:third, app:first:second: are registered as a members of app:first:main command chain
[2021-05-25 21:07:25]: Executing app:first:main command itself first
[2021-05-25 21:07:25]: Executing app:first:main chain members
[2021-05-25 21:07:25]: Execution of app:first:main chain completed