Pragmatism in the real world

Zend Framework 2 beta 4 released

Earlier this week, we got beta 4 of Zend Framework 2 out of the door. This version has some very significant improvements in it which mean that if you’re following along at home with the betas, then you’re going to be doing a bit of updating! Most of the B/C breaks are noted in this thread.

I have updated my Zend Framework 2 tutorial to match this release too.

The key new features for me are:

  • ZendServiceManager
  • ZendForm & ZendInputFilter
  • Composer support

ZendServiceManager is a Service Locator that is quite quick and is at the heart of the MVC system. I personally like the explicitness of the SM as you can more easily see what happens when you ask it for a given object.

The rewritten ZendForm implementation is also very nice. The two biggest changes are that we have decoupled the validation from the form object and that we have removed the decoration system from ZF1. Filtering and validation are now done using ZendInputFilter which means that you can implement your validation in your model layer which is a better fit for it in my opinion. The removal of the decoration system means that you can’t just echo $form anymore, but instead have to use a number of view helpers such as formInput and formElementErrors per element instead. I’m not so keen on this one, but can appreciate that there are a lot of people who will like this!

The composer support makes it much easier to use the Zend Skeleton Application now as you can simply download the zip file and then php composer.phar install in order to install ZF2 into vendor folder. We also use Composer’s autoloader.

There are a lot of other changes in ZF2 beta 4 as well. We’re really firming up the core now, so this is a good time to have a look. Beta 5 is next which should be the last beta before we enter RC.