For readers who have an experience in Zend Framework 2, in this section we'll give some information on what has changed in Zend Framework 3.
Below, the main technical differences between ZF2 and ZF3 are presented:
ZF3 is an evolutionary release, so backward compatibility is preserved in most cases. However,
some migration work still has to be done if you used
ServiceLocatorAwareInterface across your
code (which you probably did). In ZF3, this interface has been removed, and now all dependencies must be injected through
factories. So, you'll have to create factories for the most of your controllers, services, view helpers and
In ZF2, components were stored in a single GIT repository.
In ZF3, components are stored in multiple GIT repositories, one repository per component (for example,
This allows to develop and release components
independently of each other.
Components are even more decoupled than before and have minimum dependencies on each other.
has been divided into several ones. For example, routing functionality has been moved to new
You are now recommended to specify individual component names your app depends on in
although it is still possible to depend on
zendframework/zendframework package, which is a meta package
installing all available components.
In ZF3, a special Composer plugin called component installer was introduced. It allows to install components as ZF modules. It injects information about the component into the application configuration file.
ZF3 developers did a great job improving performance of
They are now about several times faster than before. The disadvantage is that you now have to do some migration
work to use the new functionality. Controller and service names are now recommended to utilize
the PHP 5.5 feature called
::class. For example, if previously you registered your controller as
now you will register it as
IndexController::class. If previously you registered service names as you wished,
now you are recommended to do that using
ServiceClassName::class. Read the documentation for
component for additional information.
In ZF2, the recommended directory structure was PSR-0, while in ZF3 it is PSR-4. This requires some (small) migration work.
Zend believes that the future of PHP is in middleware. "Middleware is, quite simply, code sitting between an incoming HTTP request, and the outgoing HTTP response." Now you can register a middleware listener in an MVC application.
Now each component repository contains its own documentation. Documentation is now in Markdown format and has become better designed.