Feature Request
| Q |
A |
| New Feature |
yes |
| RFC |
no |
| BC Break |
no |
Summary
We're migrating our (pretty big) application from laminas-mvc-console to laminas-cli. So far I genuinely like the new setup, but the migration hasn't been trivial for us so far: we've run into some issues that might be worth documenting. Here are some things I've gathered so far:
laminas-cli does not initialize a Laminas\Mvc\Application and therefore does not initiate the MVC application lifecycle. If your app depends on any MVC events (bootstrap, route, dispatch, etc) then this won't work for console commands.
- because no MVC events are triggered, a module's
onBootstrap method will also not be called, as it depends on MvcEvent::EVENT_BOOTSTRAP being triggered. Using onBootstrap is suggested by the Laminas documentation for doing lightweight application setup like setting up event listeners (we're now using ModuleEvent::EVENT_LOAD_MODULES_POST instead).
public/index.php is no longer the application entry point, so if you do any setup here then that will no longer work. The docs for the MVC skeleton suggest to add some error reporting here, so it might be good to explicitly mention warn about this in the laminas-cli docs.
There might be more, but this is what I could come up with now. I'd be willing to create a documentation PR by the way, I just figured it was better to file an issue first. :)
Feature Request
Summary
We're migrating our (pretty big) application from
laminas-mvc-consoletolaminas-cli. So far I genuinely like the new setup, but the migration hasn't been trivial for us so far: we've run into some issues that might be worth documenting. Here are some things I've gathered so far:laminas-clidoes not initialize aLaminas\Mvc\Applicationand therefore does not initiate the MVC application lifecycle. If your app depends on any MVC events (bootstrap, route, dispatch, etc) then this won't work for console commands.onBootstrapmethod will also not be called, as it depends onMvcEvent::EVENT_BOOTSTRAPbeing triggered. UsingonBootstrapis suggested by the Laminas documentation for doing lightweight application setup like setting up event listeners (we're now usingModuleEvent::EVENT_LOAD_MODULES_POSTinstead).public/index.phpis no longer the application entry point, so if you do any setup here then that will no longer work. The docs for the MVC skeleton suggest to add some error reporting here, so it might be good to explicitly mention warn about this in thelaminas-clidocs.There might be more, but this is what I could come up with now. I'd be willing to create a documentation PR by the way, I just figured it was better to file an issue first. :)