A forgiving command loader for Symfony Console

The problem

Command loading

$consoleApp = new ConsoleApplication;
$consoleApp->setCommandLoader(
new ContainerCommandLoader($iocContainer, [
'command:one' => CommandOne::class,
'command:two' => ComamndTwo::class,
])
));
php console.php command:one

Remaining problem of listing

php console.php listAvailable commands:
command:one Our first command
command:two ** Could not load
command:three Our third command
command:four Our fourth command

--

--

--

Software engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Harrison

Chris Harrison

Software engineer

More from Medium

Laravel: Use Increment IDs , UUIDs, ULIDs as primary key or optional field for the Eloquent model

Your Road To Symfony 6 Certification

Explain this pattern with example in PHP — Server Session State — SS Blog

Explain this pattern with example in PHP — Server Session State — SS Blog

Symfony Station Communiqué — 18 March 2022. A look at Symfony and PHP news!

Code logo