Zend 2.0.0 Stable adds modules and events
Zend Framework 2.0.0 Stable has arrived, five years after the release of version 1.0 in June 2007, and it is setting out to change how the open source PHP 5 framework is used. Over that time, the developers learned that foundational elements of Zend, such as its use of singleton patterns, were introducing inflexibility, while other parts intermingled concerns or made unwarranted assumptions about elements outside their definition. Learning from that experience has led to Zend Framework 2, or ZF2 as the developers call it.
A new ModuleManager is at the heart of the changes; it made the process of creating a system that lets users create and consume standalone MVC code "trivially easy". Controller dependencies are now more effectively handled with ServiceManager, a service locator, or by DI, a dependency injection container. This has enhanced the testability of Zend applications.
Another pain point for Zend developers was changing workflows or adjusting a single component; this has become easier with a new EventManager that can assist in developing a simple subject/observer pattern, aspect-oriented designs or fully fledged event-driven architectures. This has all come together in a new MVC implementation which uses controllers as services that are wired together using events.
Other changes in the framework include a rewritten HTTP stack, a new internationalisation layer built on PHP's ext/intl extension and faster, more flexible configuration parsing. Freshly added are a new Escaper for context-specific escaping and a new InputFilter for validation of data. Other rewritten components include the Form implementation, which adds binding, a more flexible Log, easier Mail, more testable Sessions, and a cleaner Uri handler. More details about these are available in the change log.
"If you've worked significantly with ZF1, ZF2 will look alien to you" said Matthew Weier O'Phinney, Zend project lead, adding "That's okay" because Zend Framework 1.0 will be supported for the next 18 to 24 months. But, he suggests people start learning ZF2. The work that the developers have done, says O'Phinney, means "that writing applications is a lot more flexible, and in many cases easier".
The new BSD-licensed Zend Framework 2 is available to download and a sample skeleton is provided to help developers get started. ZF2 documentation is online and the framework is also available for test driving on phpcloud.com.