# \[RFC\] laminas-cli - Auto-Add Invokable Factory for Commands

**URL:** <https://discourse.laminas.dev/t/rfc-laminas-cli-auto-add-invokable-factory-for-commands/1675>\
**Category:** Contributors\
**Tags:** laminas-cli\
**Created:** [June 17, 2020, 8:47pm UTC](https://discourse.laminas.dev/t/rfc-laminas-cli-auto-add-invokable-factory-for-commands/1675 "2020-06-17T20:47:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![george](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/george/32/676_2.png) [@george](https://discourse.laminas.dev/u/george)\
**Post date:** [June 17, 2020, 8:47pm UTC](https://discourse.laminas.dev/t/rfc-laminas-cli-auto-add-invokable-factory-for-commands/1675/1 "2020-06-17T20:47:56Z")

</div>

I’m about to deprecate a library [netglue/laminas-symfony-console](https://github.com/netglue/laminas-symfony-console) that laminas-cli makes obsolete 😉

One feature this lib has that might be useful is to automatically configure the container to use Invokable Factory for commands that lack a factory definition.

The [gist of it is here](https://github.com/netglue/laminas-symfony-console/blob/master/src/Container/ContainerCommandLoaderFactory.php).

As you’ll see, that feature depends on ServiceManager as the container, which made sense in my own lib because that’s what I use routinely, however, I’m not very familiar with other DI containers supported by Mezzio, hence the RFC. 😃

---

<div class="post-metadata">

**Author:** ![matthew](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/matthew/32/14_2.png) [@matthew](https://discourse.laminas.dev/u/matthew)\
**Post date:** [June 29, 2020, 2:43pm UTC](https://discourse.laminas.dev/t/rfc-laminas-cli-auto-add-invokable-factory-for-commands/1675/2 "2020-06-29T14:43:53Z")

</div>

I like this idea; there are a number of commands we provide ourselves that really do not require a factory.

We could likely handle this by doing a `has()` call before attempting a `get()`, and then directly instantiating the command if `has()` fails.

I’ve created an [issue to track this](https://github.com/laminas/laminas-cli/issues/33).
