zerkms zerkms - 1 month ago 7x
PHP Question

Variable number of options for symfony/console component

How would one configure

to accept a dynamic list of options?

That said - the names for the options aren't known on development step so I need an application to accept everything and expose it using the standard

Any chance it can be done easily (without hacking the component in million places)?

My attempts included extending the
classes but they failed due to various reasons (they are objective and
component implementation-specific). Briefly: the former requires parsing to be invoked multiple times; the latter - is instantiated in multiple places so I just couldn't find a proper way to inject it.


You can create your own ArgvInput that will allow all options.

For example you can see the slightly modified version of ArgvInput here

I have only modified lines : 178

And comment out the lines: 188-199

Then pass instance of your version ArgvInput instead of default one to

$input = new AcceptAllArgvInput();    
$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);