Zend Framework All-In-One Getting Started Package

I started a new PHP project today and as everytime I was pissed that setting up a proper project structure always takes so much time. So I thought it might be useful for some of you if I present my result right here. The following zip file contains a, for my purposes quite suitable all-in-one out-of-the-box eclipse project for a Windows development environment. I basically went through some Zend Developerzone tutorials and put it alltogether.
Let’s start with the general configuration. The code base can be used on any Windows system with WAMP installed but to get things started even faster I recommend to install the following two software packages first:

  1. PHP IDE from Zend (which is basically Eclipse with some neat little plugins for PHP development)
  2. XAMPP as WAMP package.

The whole paths in my scripts are customized for this configuration so as I said, for quick quickstart get those two first. XAMPP isn’t shipped with mod_rewrite enabled, so the first thing to do is to adjust the httpd.conf in “XAMPP_HOME\apache\conf”.
Next thing to do is to remove all files and subfolders in “XAMPP_HOME\htdocs” and to extract the zip from this page into that folder.
Afterwards change DocumentRoot and attribute from “XAMPP_HOME/htdocs” to “XAMPP_HOME/htdocs/www” and (re)start the server.
The provided zip file comes with the following features:

  • Zend Framework 0.2.0
  • Smarty Template Engine 2.6.16
  • Propel 1.2.0
  • Creole 1.1.0 (needed for Propel)
  • Phing 2.2.0 (needed for Propel)

The directory structure explained in detail:

  • app - this is where all MVC classes should go. The “views” folder conatins a example.tpl.html which is just a standard Smarty template. I prefer to name my tpl files with .html ending as they can be opened more easy and are recognised as HTML by Eclipse.
  • bin - this folder just contains the batch file for model generation
  • build - this is where all propel related files should go to. The files from the archive are simply copy & pasted from this tutorial. Generation of the sample model from that tutorial should work out-of-the-box (as long as you changed the path variables the right way).
  • cfg - Here goes the config.ini file used by Zend_Config and the autogenerated propel-config.php
  • lib - self-explanatory I guess. Be sure to add the path to /www/.htaccess if you add new libs here.
  • www - this is the document root for the apache server. Only content (images, CSS, JS, etc.) needed by clients should go here as it’s public.

As a special feature there is a generate-model.bat which can be used to automatically start the phing build process for propel ORM generation.
To get started with this base project structure there are some config lines which have to be overviewed:

  1. “set XAMPP_HOME=c:\Programme\xampp” in “bin/generate-model.bat”
  2. “smarty.template_dir= C:\Programme\xampp\htdocs\app\views” in “cfg/config.ini”
  3. Paths and DB config in “build/build.properties”

Sorry for not giving more details on how to use the code base, but it’s late, I’m tired and everything one needs to know is written on Zend Developerzone… ;)
I’m planing to integrate the LiveUser package aswell the next days, maybe I’ll give you an update. Feel free to comment, ask questions or indicate errors…
Oh, almost forgot HERE is the zip.

Leave a Reply