Tag: matthew weier o’phinney

Zend Framework 1.8 Workshop at the Dutch PHP Conference 09

Purpose of the entry

On Thursday June 11th 2009 I attended a workshop on the very (dare I say the most) popular PHP framework: Zend Framework (ZF).
I will share my experience in this entry and try to give you a quick overview on the tips I found most interesting.

Overview

  1. General experience
  2. Components
  3. Resources
  4. Closing notes

General experience

If you follow Matthew Weier O’phinney’s blog and career you already know he is a real authority in his field. Today it is the Zend Framework. As the project leader at Zend Technologies, he is doing development and coaching his team towards an ever expanding and more stable framework. The workshop itself was not really a workshop at all but an extended presentation lapping several hours. This means that during this presentation no real hands-on coding was done by the attendees.

Matthew gave a high level presentation on the most common (and some new) components. Whenever an attendee had a question he was more than willing to explain it to a deeper detail. This makes him very
approachable and someone who is eager to help.

Components

Matthew discussed the new components Zend_Application and Zend_Tool. Both new in Zend Framework 1.8 and both seem to offer when understood completely an entire new user experience on how you setup your ZF projects. Zend_Application offers you a way to do bootstrapping on a more uniform way and Zend_Tool offers you tools to do the scaffolding for you. If you want more info on both of them please visit the official documentation or take a look at the presentation which I included at the end of this entry. Of course Zend_Auth and Zend_Acl were also discussed and in such a matter that it deviated from the way it was best practice in ZF 1.6 as described in the marvelous Zend Framework In Action book by Rob Allen. If you do not yet own this book hop over to Rob Allens webpage, Amazon or wherever you can get your hands on it. At the moment it is still one of the best books about ZF and offers some very valuable tips on the subject. The deviation illustrates that a framework like every other piece of code is organic and has the tendency to lead its own life. Which is actually a good thing, “grow or die” remember?

One of the main tips I got from the presentation was the use of the DAO (Data Access Object) principle.
Instead of adding your data access directly into your model you should add a DAO as a layer between your model and data resource (database, xml, csv, …). This way if you want to switch from a database to a webservice (think of scalability), you do not have to rewrite every single model but only the DAOs. If you want to know more about scalability I will be doing an entry on this based on the incredible presentation done by Eli White, PHP Community Manager & DevZone Editor-in-Chief at Zend Technologies.

Zend_Form was also covered and Matthew explained that it would be in the project it’s best interest to set the decorators in the view instead of the controllers/models. Decorators are a part of the display and thus should be handled in the view. He showed a practical example of how to style and display form elements separately in the view instead of doing the <?php echo $this->form; ?>. This is done by simply accessing the form element through the properties of the form. <?php echo $this->form->username; ?>

Of course other useful tips were shared in this presentation and I stronlgly encourage you to attend one of these whenever and wherever you have the chance to attend one. Because of the purpose of this entry I am not going any deeper into the subject. You can find Matthews presentation online .

Resources

Closing notes

I hoped you enjoyed reading this entry as much as I wrote it. I surely would recommend adopting a framework to your skills. ZF is a smart choice and the community is very very strong. In todays world if you do not know one or 2 of the major players out there like ZF or Symfony you are sure to run into trouble sooner or later regarding employment. For a more direct access to the community attend workshops like the one I just described or visit the #zftalk irc channel on irc.freenode.net

Sunny greetings from Belgium,
Nick Belhomme