Pragmatism in the real world

Getting Started with Zend Framework 1.8 and 1.9

Screen short of Zend Framework tutorial

This tutorial is intended to give an introduction to using Zend Framework to write a simple database driven application. It has been extensively rewritten for version 1.8 of the framework and takes full advantage of the Zend_Tool command line script and Zend_Application for bootstrapping. Other components used include Zend_Controller, Zend_View, Zend_Db_Table and Zend_Form.

This tutorial has been tested on versions 1.8 and 1.9 of Zend Framework. It will not work on any version prior to version 1.8.

Tutorial note: If you are getting 404 errors when going to any page other than the home page, please make sure that you have set AllowOverride to All in your Apache configuration and have enabled the mod_rewrite extension.

If you are deploying to a “user” site (e.g. http://localhost/~rob), then you need a RewriteBase line in your .htaccess file that looks something like: RewriteBase /~rob/zf-tutorial/public/.

English version: Dowload the PDF (v1.6.4).

Code

The associated code is available:

Further reading

Once you have finished this tutorial, consider buying my book, Zend Framework in Action. Also, the Quick Start is worth reading.

Chris Kirk has kindly provided a Q&A PDF which may help if you are having problems.

Previous versions of this tutorial

The tutorial for Zend Framework 1.5, 1,6 and 1,7 is still available, along with the translations for it. You can also find original tutorial for Zend Framework 1.0.

Changelog

1.6.4 (20/Jan/2010)
Fixed more typos and errors. Thanks to many people who reported them.
1.6.3 (05/Aug/2009)
Fixed typos and tested with 1.9.0. Updated to note that 1.9 comes with its own BaseUrl view helper. Thanks to many people who reported the typos, including Spabby on Freenode IRC’s #zftalk channel :)
1.6.2 (05/May/2009)
Code in deleteAction() now matches code in zip file! Thanks to Luis and Oleg Lobach.
1.6.1 (01/May/2009)
Minor fixes. Thanks to Tomas Fejfar and Luis.
1.6.0 (01/May/2009)
Completely updated and significant portions revised for Zend Framework 1.8