Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Master Zend Framework:
What Are Delegator Factories and Why You Should Use Them
Jun 27, 2018 @ 17:17:24

On the Master Zend Framework site Matthew Setter has posted a tutorial introducing you to delegator factories and what they're useful for in Zend Framework-based applications.

Ever wanted to dynamically expand the functionality of an object which you retrieve from your dependency injection container, based on different needs, yet without creating messy, hard to maintain configurations? If so, then you're going to want to know about a powerful technique called Delegator Factories.

He starts with a brief definition of what the factories are and the basics of what they allow you to do (briefly stated, they decorate DI services from the container). He then gets into a practical example, showing the update of a script from v2 to v3 of Zend Expressive, to wrap route definitions in a delegator to handle the difference. Complete code is provided as well showing the initial version of the routing code and the application of the delegator.

tagged: delegator factory zendframework zendexpressive tutorial routing

Link: https://masterzendframework.com/what-are-delegator-factories/


Trending Topics: