LogoPhly, boy, phly
the weblog and site of Matthew Weier O'Phinney

Monday, August 11. 2008

Zend Framework 1.6.0 Preview, or, PHP 4 is Dead

PHP 4 officially died Friday. I started programming PHP with release candidates of 4.0.0 -- which simultaneously introduced me to the GNU C compiler and toolset. My first official job using PHP was at a shop that was using PHP 3, and considering the costs of upgrading to PHP 4 -- which clearly offerred many benefits over its predecessor. I switched to PHP 5 as soon as the first official release was made four years ago -- the pains of reference handling with objects, the introduction of a unified constructor, first-class support for overloading, and SimpleXML won me over immediately, and I've never looked back. Goodbye, PHP 4; long live PHP!

I'm celebrating with the second release candidate of Zend Framework 1.6.0, which should drop today. There are a ton of new features available that I'm really excited about. I'm not going to go into implementation details here, but instead catalogue some of the larger and more interesting changes that are part of the release.

Dojo Integration

I've blogged a number of times about this, but a picture is worth a thousand words... or lines of code, in this matter. I'm going to show these as images, as I still need to determine how and where to get a public demo up, so bear with me. First:

Dojo and ZF integration at work

What you're looking at is a form generated using Zend_Form (or, in this case, Zend_Dojo_Form). It contains four subforms, each represented by a tab. (I also created an additional decorator that creates the fifth tab.) The form elements are all Dijits, presenting a common look-and-feel, and have a variety of validators and features themselves.

The fifth tab shows off some fun features of Dojo: the ContentPane actually has no content, but was defined with an 'href' attribute pointing to a resource on the server. On this particular page, I define a dojo Grid that consumes an ItemFileReadStore -- a fancy word for a remotable dojo.data resource. I used Zend_Dojo_Data to provide that, and the result is that, when you click on the tab, the following loads dynamically:

Dojo and ZF playing nice and creating grids

This stuff is ridiculously easy to pull off and create now -- which means I no longer have any excuse for crappy looking forms or not adding ajax features to apps.

In experimenting with Dojo, I also discovered its build tools. Once your code is developed, it's a trivial task to tally up all your dojo.require statements, throw them in a build profile, and create a layer for use with your application. Doing so has tremendous performance and bandwidth benefits, and can mean the difference between a good application and a great one, in terms of user experience. I'll blog more on this later, but I'm excited that, because we're shipping a full source build of Dojo, this support will be delivered to ZF users out of the box.

Unit testing infrastructure

I've also blogged about this before. I've been using the Zend_Test_PHPUNit_ControllerTestCase on some personal projects as well as projects related to application examples I'm working on for some upcoming presentations.

There's nothing quite like having the assurance that your entire application -- not just your models -- works according to the expectations you've worked up, and that the document structure adheres to the design. This is going to become a must-have component for serious ZF developers.

Captcha Support

Captchas have become an essential tool in the anti-spam arsenal of most sites. While tools such as Akismet are fantastic, it's even better not to even need to send data to Akismet to process in the first place.

Stas worked up a nice design for captchas as we were finishing 1.5.0, but we didn't have time to complete it before shipping the release. This turned out to be fortuitous, as we have received community contributions of Figlet and ReCaptcha support since then. Zend_Captcha provides adapters for each of these, as well as for a GD-based image captcha. You can now pick and choose which works best for your site or altruistic leanings; using them in your forms is as simple as creating a Zend_Form element.

SOAP Support

Zend_Soap has been languishing in the incubator since before the 1.0 release. The WSDL autogeneration was mostly untested, and for several use cases, completely broken. Additionally, I had created but never completed testing and documenting Zend_Soap_Server, a thin wrapper on top of PHP's own SoapServer class.

Alex took Zend_Soap on as a project for 1.6.0, and has done tremendous things with it. He has even created a compatibility matrix that users can update to show how WSDL autodiscovery works with various SOAP clients -- which will help us improve it in the future.

Form Improvements

There have been many feature requests and bugs filed against Zend_Form since its debut in 1.5.0, and I tried to address the most requested and critical of these for the release. There are several improvements that should make using Zend_Form easier and more flexible:

  • Ability to set custom element or form errors. You can now specify the specific error message(s) to use if an element or form does not validate, as well as mark it as invalid. This is useful in particular when validating authentication; when authentication fails, you can mark the form invalid and specify a custom error message.
  • Lazy-loading of filters, validators, and decorators. Previously, these were instantiated as soon as they were added to the element or form. Now the item metadata is simply stored; only when the item is retrieved is it instantiated. This offers some performance improvements in a number of areas: if you're not validating the form, the validators are not loaded; if you're not rendering the form, the decorators are not loaded. (One note: filters are almost invariably loaded, as they are used each time getValue() is called.)

    Another benefit of this change is that you can register plugin prefix paths any time before the plugin is actually retrieved. This should lead to less confusion and issues about event sequence, and provides additional flexibility to the component.
  • Better array notation support. Several patches were provided by contributors, and I also re-worked the objects to do better name and id generation; the net result is seamless array notation for sub forms.

FireBug Support

The author of FirePHP, Christoph Dorn, has committed a new component to ZF, Zend_Wildfire. Wildfire is a project for standardizing communication channels between components; FirePHP is one implementation that communicates with the FireBug console for Firefox. The Zend_Wildfire component consists of a log writer, Zend_Log_Writer_Firebug, and a profiler, Zend_Db_Profiler_Firebug, which logs DB profiling information for use in FireBug. Together, these allow you to do more informed debugging in your browser, and can complement PHP debuggers such as XDebug and the Zend Debugger.

Pagination Support

Raise your hand if you've ever needed to provide paginated result sets for your data -- good, I see a ton of virtual hands waving out there. Pagination is something that needs to be done frequently, usually needs to be tailored to your data and site, and is almost invariably a pain every single time. Zend_Paginator aims to make it simple.

Any iterable data set can be consumed by Zend_Paginator. You then need only specify what the current page number is and how many results per page to display -- it works out the calculations, and, when used in conjunction with the paginationControl() helper, will even provide your pager for you. No more writing the algorithms by hand.

And then there was...

There are too many improvements and features really to count at this stage. We had originally intended this release to be smaller and offer fewer features, but as the time for release came closer, we discovered we had another monster on our hands. There is much to be excited about with this release -- and still much, much more in the wings for future releases.

We are planning on tightening our release cycle so that we can offer more frequent and less intimidating releases in the future. Combine this with improvements we've been making to the proposal process, and you should be seeing more great things coming from the community -- more frequently!

A huge thank you to all contributors, the Dojo team for answering my many questions, and my family for putting up with my long hours the last couple months. Happy developing!

Posted by Matthew Weier O'Phinney in PHP at 13:15 | Comments (21) | Trackback (1)
Defined tags for this entry: php, zend framework
Related entries by tags:
Zend Framework 1.7.0 Released
Vimgrep and Vim Project
Pastebin app updates
ZendCon08 Wrapup
Setting up your Zend_Test test suites

Trackbacks
Trackback specific URI for this entry

Zend Framework 1.6 RC2 available
The second 1.6 Release Candidate was published earlier this day and - wow - we’re going to get a lot of new stuff to play with. Or like Matthew put it: There are a ton of new features available that I’m really excited about. Word! Not only...
Weblog: roetgers.org
Tracked: Aug 11, 18:03

Comments
Display comments as (Linear | Threaded)

If only PHP4 would have lived a little bit longer to see the second release candidate of ZF :-)
#1 Federico on 2008-08-11 15:25 (Reply)
Hi Matthew,

Great news... awful question but here it goes anyways:

When can we expect ZF 1.6 to be stable? By all means guesstimate

I need to ascertain whether i should upgrade to 1.6. Currently working on a new project due mid-Sep 08.
#2 Quinton (Link) on 2008-08-11 16:06 (Reply)
1.6.0 final will be out before the end of this month.
#2.1 Matthew Weier O'Phinney (Link) on 2008-08-11 16:09 (Reply)
I would wish ZF would stick with its original promise, KISS, not trying to compete with PEAR on the breadth of packages. Instead more and more packages are being added while there is plenty of work left in existing packages like the http client, the feed parser etc.
#3 Lukas (Link) on 2008-08-11 18:25 (Reply)
ZF users do not necessarily want to go to other frameworks and libraries to get the functionality they need. Additionally, like PEAR, ZF is a community driven project; many of the new features are features that have gone through the proposal process and are contributed because a number of developers have expressed a need and come up with a solution.

Finally, we are well aware that there are issues with existing packages; we do keep an issue tracker to keep track of these. However, we must balance the severity of issues when prioritizing for each release, and with the shear volume of packages, we cannot get to every issue for every release (though we are striving harder to do so).
#3.1 Matthew Weier O'Phinney (Link) on 2008-08-11 19:33 (Reply)
Well thats a change in philosophie that was never announced. In the beginning it was about providing solid KISS packages that are well documented for the core needs of people.

Also if there are open bugs for a year and there is a patch for a few months, I have a hard time understanding why a patch does not make it in.

Anyways its becoming clearer and clearer that whoever is behind the steering wheel is not now following the original mission statement (in open source its obviously legit to change) and that ZF now tries to take PEAR head-on. Kinda a pitty that back then there was no attempt made to work together with the PEAR community with the "excuse" we just want to provide solid core components and while the core components are by far not solid yet, more and more components are getting added. Obviously the test and documentation situation is still better in ZF across the board. But you are aware that all these components need maintainers. That maintainers move on etc. Soon you will see similar issues that PEAR has faced. Only with the difference that you guys splintered the PHP lib development community further. And for what gain? This bogus "clean IP" argument?
#3.1.1 Lukas (Link) on 2008-08-12 02:58 (Reply)
If there's been any change in philosophy, then it may have occurred when I joined Zend to manage the ZF project. That said, I did a lot of research in to the past development- and future direction- of ZF before starting to influence the direction of the project in any substantial way. And the ZF team has tried to be as open as possible with every decision; in my experience with OS projects we consult the community relatively often to determine the direction of the project. If you think there's more that we can do, please let us know.
I can assure you that we have no intention whatsoever of 'to take PEAR head-on'- or any other project, for that matter. The fact is, the PHP community is huge and there is room for all of these projects. And considering that it is impossible to come up with a single solution that is optimal for every developer, I believe choice is a very good thing in this case.
I see your point about the issues, and I plan to address it by posting a report based on issue age very prominently. This will be rolled out with a general update to the issue tracker that should make it easier to use and clearer for new contributors. Hopefully this will be available around the 1.6 release.
We have also begun to discuss the issue of maintainers moving on, but we don't have a final process to put in to place yet.
To be honest, Lukas, I feel that you're being very hard on the ZF project lately. I'm not sure why, but I do want to make it clear that many people find it to be a very useful project, and despite the concerns that you seem to have with how the project is run, our contributors and users have done an outstanding job in building both the project and community. That said, I'll take all the criticism that you can throw at Zend and the ZF project and try to do what I can with it. :-)

,Wil
#3.1.1.1 Wil Sinclair (Link) on 2008-08-13 13:59 (Reply)
Maybe I am still bitter that nobody at Zend bothered to speak with PEAR before launching ZF. Of course the PHP community is big, but I never understood why Zend felt that there was no way to cooperate. I am sure if they would have pored their ressources into PEAR we would be further along today.

Now I must say that I can see that ZF packages were designed and documented. But given that they are riddled with bugs PEAR has long fixed, I am wondering at what gain? And with the change of philosophie I feel like you gave people a false lure (as in that they thought they could expect all components to be made as solid as other solutions before you guys branch out).

At least I was expecting this and after my first couple month project using Zend, I feel that without having PEAR packages to look at, to fix ZF bugs, I would be in trouble. Which is something I would expect other open source developers would naturally do to begin with if it wasnt for this clean IP BS, which I will never get tired knocking.
#3.1.1.1.1 Lukas (Link) on 2008-08-14 01:27 (Reply)
Just to make it clear, I am not telling people to ignore ZF in favor of PEAR. I am trying to tell the ZF developers to stay true to their original mission statement and then I will gladly grab what's in ZF before going to PEAR packages for niche features.
#3.1.1.1.1.1 Lukas (Link) on 2008-08-14 01:44 (Reply)
Lukas,

When will you commit these bug fixes that you mentioned getting from PEAR?
#3.1.1.1.1.1.1 Slango on 2008-08-14 16:28 (Reply)
Okay, that was a bit douchey of me. My two cents is this: ZF is an open source project, and anyone is welling to contribute. Zend has laid an excellent foundation for future development and improvements, but if anyone is unhappy about the number of un-addressed bugs or the quality of components, it's up to them to make changes. As far as I'm concerned, since Zend has given anyone the opportunity to contribute, they have no responsibility to act on any agenda but their own.

What's more, this whole ZF vs. PEAR nonsense is beginning to bug me. I encourage Zend to take PEAR head on. In a free market competitors will struggle to gain the upper-hand by satisfying consumers more than the other, and in the end, the beneficiaries are the users. I think it's the same with developers. Whichever project satisfies their needs more will earn their support. Perhaps the supporters of PEAR ought to mobilize and fight back. Make no mistake, nothing precludes a developer from contributing to both.
#3.1.1.1.1.1.1.1 Slango on 2008-08-16 00:08 (Reply)
s/anyone is welling to contribute/anyone who is willing to can contribute/
#3.1.1.1.1.1.1.1.1 Slango on 2008-08-16 00:10 (Reply)
Well I have provided patches, others have supplied patches. But instead of applying them, more and more new packages are added for functionality that exists else where already (maybe not as compatible with PHP5 or as well documented, but again originally ZF wanted to focus on doing the core set "right").

Also ZF chose to require a CLA. I (not sure if you follow my blog on pooteeweet.org) and others have made it clear why we feel that CLA's in general and the Apache base CLA's in particular (unclear clause about patents) is unacceptable for any sane OSS developer.
#3.1.1.1.1.1.1.1.2 Lukas (Link) on 2008-08-18 04:10 (Reply)
Hi Matthew,

I have to partially disagree. There're several issues opened for more than year, much longer than a number of packeges live in ZF. E.g.:
framework.zend.com/issues/browse/ZF-1398
framework.zend.com/issues/browse/ZF-1541 (Long time awaited improvement)
framework.zend.com/issues/browse/ZF-1688 (Postponed? 12 votes!)
framework.zend.com/issues/browse/ZF-1842

Where's the 80/20 rule? I don't believe that 80% of users will ever need any service component, but certainly more than 90% use Zend_DB now. :-(
#3.1.2 Martin on 2008-08-12 03:30 (Reply)
Asome job people.

One question about zend_form:

I look at zf documentation and I can't figure out how to setting a form level error message
#4 Jose Grieco on 2008-08-16 17:06 (Reply)
http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.validation.errors
#4.1 Matthew Weier O'Phinney (Link) on 2008-08-19 10:49 (Reply)
I've been reading the articles on ZF throughout your blog. Maybe here might not be the right place but I'd be really grateful for some input!

Is it worth holding out for a refactor of the ZF for PHP 5.3 and if not do you think it be easy to upgrade/path previous versions to any new versions which support 5.3? From what I can see we won't see a production ready version until after christmas at the earliest of 5.3 ...
#5 James Gardner on 2008-08-18 02:59 (Reply)
I wouldn't hold out for a PHP 5.3 version of ZF. We have only done some very, very prelimnary scoping of ZF 2.0, which will be the first version to support PHP 5.3. Why? because until this month, the features to be included in 5.3 have been very much in flux. Additionally, it doesn't make sense for us to support 5.3 until it has (a) stabilized its API, and (b) had some measure of adoption.

The features we plan to adopt will likely have wide-ranging effects on the framework, and we will need to plan carefully. While we will allow backwards compatibility breaks for 2.0, we also want to have as many tools in place to allow migration from pre-2.0 versions. Identifying the new PHP features we wish to use and providing the migration tools will take time. At this point, we do not envision a ZF version that makes full use of 5.3 until mid- to late 2009 (though we will, and do, _run_ on 5.3 prior to that).
#5.1 Matthew Weier O'Phinney (Link) on 2008-08-19 10:48 (Reply)
do you have a public demo of the dojo stuff yet?

my main interest is with dojo.data interacting with the server. in dojo 1.2 there is a jsonRestStore. are there any good examples demonstrating a Zend Rest Server?

i don't necessarily need rest but it seems to be a conceptually simple way to serve data.

basically, getting dojo.data to interact with the server is the missing link for me at the moment.
#6 ben hockey on 2008-08-21 12:40 (Reply)
I don't have a public example up yet, but there will be one no later than when we go live with 1.6.0 (we're adding a demo area to the ZF site).

I've done a fair bit with using ZF actions to return dojo.data payloads using Zend_Dojo_Data. It's trivial -- simply add your Iterable object or array to the Zend_Dojo_Data object, and echo it. I've used it to feed grids, ComboBoxes, and FilteringSelects with no issues.
#6.1 Matthew Weier O'Phinney (Link) on 2008-08-21 13:07 (Reply)
i've managed to get the ZF actions to feed the data. the problems i have are probably more on the dojo side. for example, if i create a new item in the store then what do i do about it's id? i figured that if i used a jsonRestStore with a compatible Rest server then some of these problems might fix themselves. i would hope that if i attach a grid to a jsonRestStore then if i edit an item in the grid or add a new one then the store will know what to do and talk to the server in a way that the server understands and my data will all work without me needing to get involved.

it would be nice if it could be as simple as this:
Zend
- give the service/resource an address (URI)
- connect it to a resource (typically a db)
Dojo
- point the store to the server
- connect the widget to the store

my problem is not so much formatting the data but it's determining how the client and the server should make requests and respond with each other in a way that works for both of them.
#6.1.1 ben hockey on 2008-08-21 13:28 (Reply)
What you're talking about is a writable dojo.data store... and this I have not yet attempted. It's a feature I would like to support through a class extension to Zend_Controller_Action to make it trivial to do so, but for now, you have to hack it on your own.

Look for this sort of support in future releases of ZF - likely in the 1.8.0 time frame.
#6.1.1.1 Matthew Weier O'Phinney (Link) on 2008-08-21 15:02 (Reply)

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
 
  • Home
  • Resume
  • Blog
  • Phly PEAR Channel
  • Contact Me
  • About this site

ZCE

Zend Education Advisory Board Member

Add to Technorati Favorites

Calendar

Back November '08 Forward
Mon Tue Wed Thu Fri Sat Sun
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Quicksearch

Links

  • PHLY - PHp LibrarY
  • Paul M. Jones
  • Mike Naberezny
  • Shahar Evron
  • Planet PHP
  • Zend Where I now work
  • Garden.org Where I once worked

Archives

November 2008
October 2008
September 2008
Recent...
Older...

Categories

XML Linux
XML Personal
XML Aikido
XML Family
XML Programming
XML Dojo
XML Perl
XML PHP

All categories

Syndicate This Blog

XML RSS 0.91 feed
XML RSS 1.0 feed
XML RSS 2.0 feed
ATOM/XML ATOM 0.3 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Comments

Show tagged entries

xml best practices
xml books
xml conferences
xml dojo
xml dpc08
xml file_fortune
xml linux
xml mvc
xml oop
xml pear
xml personal
xml php
xml phpworks08
xml programming
xml ubuntu
xml vim
xml webinar
xml zendcon
xml zendcon08
xml zend framework
© 2004 - present, Matthew Weier O'Phinney
matthew-web <at> weierophinney.net