ZF ZendFramework In Case Of

2013 - 05 - 20

URL to this page: bit.ly/s_zf


api v1.11


manual v1.11


coding style



zf db table



with tb twitter-bootstrap




A Quick Starter for ZF New Guys

I was following: "Getting Started with Zend Framework", By Rob Allen, v1.7.7


ENV: i am using ZendFramework-1.11.0.zip instead of zend-server, in Linux.

ps: if apt-get install zend-framework-bin (1.10) , then default lib will be /usr/share/php/libzend-framework-php
( ref: /usr/share/zend-framework /usr/share/doc/libzend-framework-php)

#apt-get install phpunit

//this is for php-pear. may need to fix: /etc/apt/sources.list and 'apt-get update' before install unit.

modify /etc/php5/apache2/php.ini, change: (maybe also: /etc/php5/cli/php.ini):

include_path = ".:/etc/php5/zendFramework_1.11.10/library:/usr/share/php:/usr/share/php/PHPUnit"

#zf show version

ok, so:
#zf create project projectName

#apt-get install php5-sqlite

The following is a sample VHOST you might want to consider for your project.
 <VirtualHost *:80>
ServerName quickstart.local
DocumentRoot /now/codes/zend_framework/quickstart/public

SetEnv APPLICATION_ENV "development"

<Directory /now/codes/zend_framework/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all


now, u should be able to access the web.
see /var/log/apache2/error.log for detail if get 500 error.
e.g., if no rewrite is available:

#ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/

default configuration is placed in application/configs/application.ini
#zf enable layout


// Something More:

3 sentences about : zf configure db-adapter blala....

Create the script as scripts/load.sqlite.php
! flesh out: scripts/load.sqlite.php
php scripts/load.sqlite.php --withdata

zf create db-table Guestbook guestbook

zf create model GuestbookMapper

! flesh out: models/GuestbookMapper.php

Now it's time to create our model class.

zf create model Guestbook

! flesh out: models/Guestbook.php class: Application_Model_GuestbookMapper

Lastly, to connect these elements all together, lets create a guestbook controller

zf create controller Guestbook

(this will create view, too.)
! flesh out: controllers/GuestbookController.php
! flesh out: views/scripts/guestbook/index.phtml


zf create form Guestbook

! flesh out: application/forms/Guestbook.php

zf create action sign Guestbook //format : zf create action actionName ControllerName

this will create a signAction() method in our controller, as well as the appropriate view script.
! flesh out: action: sign in Controller: Guestbook


Write a Comment