Download the PHP package rikby/symfony-command-collector without Composer
On this page you can find all versions of the php package rikby/symfony-command-collector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rikby/symfony-command-collector
More information about rikby/symfony-command-collector
Files in rikby/symfony-command-collector
Package symfony-command-collector
Short Description Small script for extending symfony command for collecting symfony sub-commands.
License GPL-3.0
Informations about the package symfony-command-collector
Symfony console commands collector
Installation
Just run in your project:
First steps
There is a code which could help you to merge sub-commands from different places.
Let's admit we have command super
which is an enter-point for our console commands.
super
has sub-commands sub1
and sub2
.
We have packages which could extend this command. There two sub-commands in two packages.
Content of bin/super
Code ->setPaths([__DIR__.'/../vendor/*/*/bin'])
will push to search files in bin/
directory within all packages.
Target filename is super-app-inlclude.php
because of ->setName('super')
and format %s-app-inlclude.php
.
Content of vendor/my-vendor/pack111/bin/super-app-include.php
:
Content of vendor/my-vendor/pack222/bin/super-app-include.php
:
As you may suspected the generated file bin/.build-super.php
will contain following code of these two files super-app-include.php
.
In case you need to regenerate the file you have two options:
- Remove file
bin/.build-super.php
- Call
CollectorTrait::forceCaptureCommands()
Integrate into a class
Actually there is the trait Rikby\SymfonyConsole\CommandCollector\CollectorTrait
which can be used anywhere.
Class Rikby\SymfonyConsole\CommandCollector\Collector
just wraps it.
TBD
There is an approach for including ***-app-include.php
instead merging them.
Maybe it would be useful to links to these files.