# Abstract factoy vs factory

**URL:** <https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368>\
**Category:** Components & MVC\
**Tags:** laminas-servicemanager\
**Created:** [June 15, 2023, 7:36pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368 "2023-06-15T19:36:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan81](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@Stefan81](https://discourse.laminas.dev/u/Stefan81)\
**Post date:** [June 15, 2023, 7:36pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/1 "2023-06-15T19:36:53Z")

</div>

Hi everyone,

I’m wondering about the best practice for using abstract factories vs factories.  
I understand that abstract factories can be convenient, as they can handle the bulk of the instantiation logic for a group of related classes. However, I’m also concerned about performance. I’ve read that abstract factories can introduce some overhead, so I’m wondering if there’s a benchmark that shows how much of a performance impact they have.

In general, is it best practice to use abstract factories for all classes? Or is it better to use factories for specific cases where it makes sense?

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [June 16, 2023, 8:49am UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/2 "2023-06-16T08:49:07Z")

</div>

Hello and welcome to our forums! 😃

Have you checked the documentation of laminas-servicemanager on this topic?

> **[Factories vs Abstract Factories - laminas-servicemanager - Laminas Docs](https://docs.laminas.dev/laminas-servicemanager/cookbook/factories-vs-abstract-factories/)**
>
> laminas-servicemanager: factory-driven dependency injection container

---

<div class="post-metadata">

**Author:** ![ALTAMASH80](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/altamash80/32/895_2.png) [@ALTAMASH80](https://discourse.laminas.dev/u/ALTAMASH80)\
**Post date:** [June 16, 2023, 3:53pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/3 "2023-06-16T15:53:09Z")

</div>

Thanks for asking the question @Stefan81 and thanks for answering @froschdesign. I want to know how many hidden console tools are out there in Laminas like [this](https://docs.laminas.dev/laminas-servicemanager/console-tools/).

---

<div class="post-metadata">

**Author:** ![Stefan81](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@Stefan81](https://discourse.laminas.dev/u/Stefan81)\
**Post date:** [June 21, 2023, 8:37pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/4 "2023-06-21T20:37:42Z")

</div>

thanks…i will check that…  
i think i am going to use Factory over abstract Factories

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [June 22, 2023, 7:40am UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/5 "2023-06-22T07:40:23Z")

</div>

> [@ALTAMASH80](#):
>
> I want to know how many hidden console tools are out there in Laminas like [this](https://docs.laminas.dev/laminas-servicemanager/console-tools/).

The issue was indeed never prominent, but it was not hidden either. Look into the documentation or on your own hard disk. 😜

The interest has not been very great so far and also the assistance leaves much to be desired:

- [Collect ideas for CLI commands · laminas/laminas-cli · Discussion #88 · GitHub](https://github.com/laminas/laminas-cli/discussions/88)
- [CLI commands for components · GitHub](https://github.com/orgs/laminas/projects/17/views/1)
- [https://github.com/search?q=org%3Alaminas+"laminas-cli"+language%3APHP&type=code&l=PHP](https://github.com/search?q=org%3Alaminas+%22laminas-cli%22+language%3APHP&type=code&l=PHP)

Version 4 of laminas-servicemanager brings [a breath of fresh air](https://github.com/laminas/laminas-servicemanager/pull/176) to the topic.

---

<div class="post-metadata">

**Author:** ![ALTAMASH80](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/altamash80/32/895_2.png) [@ALTAMASH80](https://discourse.laminas.dev/u/ALTAMASH80)\
**Post date:** [June 22, 2023, 4:43pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/6 "2023-06-22T16:43:12Z")

</div>

Hi @froschdesign,

Thanks for sharing the information about the list of commands planned for future updates of Laminas. My question is will these commands work on both Laminas-MVC and Mezzio?

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [June 22, 2023, 5:43pm UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/7 "2023-06-22T17:43:33Z")

</div>

> [@ALTAMASH80](#):
>
> …list of commands planned for future updates of Laminas.

These are only lists to collect ideas, but there is no fixed plan. Unfortunately, the interest so far is not so great and there are no ideas or help from the community.  
The only plan so far is to document and highlight the new/converted commands of laminas-servicemanager in [version 4.0.0](https://github.com/laminas/laminas-servicemanager/milestone/2).

> [@ALTAMASH80](#):
>
> My question is will these commands work on both Laminas-MVC and Mezzio?

Mezzio already contains helpful commands:

> **[CLI Tooling - mezzio - Laminas Docs](https://docs.mezzio.dev/mezzio/v3/reference/cli-tooling/)**
>
> PSR-15 Middleware in Minutes

---

<div class="post-metadata">

**Author:** ![froschdesign](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/froschdesign/32/38_2.png) [@froschdesign](https://discourse.laminas.dev/u/froschdesign)\
**Post date:** [June 23, 2023, 11:55am UTC](https://discourse.laminas.dev/t/abstract-factoy-vs-factory/3368/8 "2023-06-23T11:55:39Z")

</div>

> [@ALTAMASH80](#):
>
> I want to know how many hidden console tools are out there…

> <https://github.com/laminas/laminas.github.io/issues/180>
>
> \### Feature Request
> 
> \#### Summary
> 
> The various CLI commands of the component…s are spread over different documentations, an overview - possibly with a filter - should make it easier to find them.
> A call for help could also be added:
> 
> \- https://github.com/laminas/laminas-cli/discussions/88
> \- https://github.com/orgs/laminas/projects/17
