Search code examples
phpsymfonysymfony-console

Is it possible to pass parameter as namespace in Symfony console?


I'd like to pass parameter to Symfony Console thus commandName:parameter1 parameter2. Is it possible and how I can do it?


Solution

  • Yes, it is possible with the addArgument method. you should call it in constructor. There is a full example in the documentation that explains how to use it.

    But, the format will be commandName parameter1 parameter2 or app:commandName parameter1 parameter2.