Abstract factoy vs factory

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!

Hello and welcome to our forums! :smiley:

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

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.

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

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

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

Version 4 of laminas-servicemanager brings a breath of fresh air to the topic.

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?

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.

Mezzio already contains helpful commands: