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

Master Zend Framework:
How To Do RAD Prototyping and Development With The ReflectionBasedAbstractFac
Feb 09, 2017 @ 20:55:47

The Master Zend Framework site has posted a new tutorial showing you how to [use the ReflectionBasedAbstractFactory for prototyping](How To Do RAD Prototyping and Development With The ReflectionBasedAbstractFactory) and development in a Zend Framework 2 application.

Rapid application development isn't normally associated with Zend Framework. That's considered Laravel's domain. But thanks to the ReflectionBasedAbstractFactory, prototyping and rapid application development is now just as easy in Zend Framework as it is in Laravel. In today's tutorial, I'm going to show you how.

When using Zend ServiceManager, it's quite common to create a factory class for any class which require constructor dependencies. While tedious, it ensures we both follow development best practices and that the code we create is fully testable.

However, if we're not careful, it can lead to an enormous amount of factories — perhaps where we have one factory for every class. Needless to say, that can seriously hurt development. There needs to be a better way. And there is!

The ReflectionBasedAbstractFactory is included in the 3.2.0 release of Zend ServiceManager and makes use of the Reflection API to do some automagic, handy things. The article starts with some reasons why you might use it and a brief look at how it works. It also points out that, despite how it makes things easier on the developer it's "not for production" and instead relying on the other configuration handlers to help out.

tagged: zendframework2 rapid development prototype reflectionbasedabstractfactory tutorial

Link: http://www.masterzendframework.com/rad-prototyping-and-development-with-reflectionbasedabstractfactory/