Zend framework

Páginas: 16 (3823 palavras) Publicado: 23 de setembro de 2011
Getting Started with Zend Framework
By Rob Allen, www.akrabat.com Document Revision 1.7.6 Copyright © 2006, 2010

This tutorial is intended to give an introduction to using Zend Framework by creating a simple database driven application using the Model-View-Controller paradigm. Note: This tutorial has been tested on version 1.10.1 through to 1.11.4 of Zend Framework. It stands a very goodchance of working with later versions in the 1.x series, but will not work with versions prior to 1.10.1.

Zend Framework has the following requirements: • PHP 5.2.4 (or higher) • A web server supporting mod_rewrite or similar functionality.

Tutorial assumptions
I have assumed that you are running PHP 5.2.4 or higher with the Apache web server. Your Apache installation must havethe mod_rewrite extension installed and configured. You must also ensure that Apache is configured to support .htaccess files. This is usually done by changing the setting:
! AllowOverride None AllowOverride All


in your httpd.conf file. Check with your distributionʼs documentation for exact details. You will not be able to navigate to any page other than the home page in this tutorial ifyou have not configured mod_rewrite and .htaccess usage correctly.

Getting the framework
Zend Framework can be downloaded from http://framework.zend.com/download/latest in either .zip or .tar.gz format. Look at the bottom of the page for direct links. The “Minimal” version is what you need.

Setting up Zend_Tool
Zend Framework is supplied with a new command line tool. We start by setting itup.

Zend_Tool for Windows
• Create a new directory in Program Files called ZendFrameworkCli • Double click the downloaded archive file, ZendFramework-1.10.6-minimal.zip. • Copy the bin and library folders from within the ZendFramework-1.10.6-minimal.zip folder window to the C:\Program Files\ZendFrameworkCli folder. This folder should now have two sub folders: bin and library. • Add the bindirectory to your path: • Go to the System section of the Control Panel. • Choose Advanced and then press the Environment Variables button. • In the “System variables” list, find the Path variable and double click on it. • Add ;C:\Program Files\ZendFrameworkCli\bin to the end of the input box and press okay. (The leading semicolon is important!)
Page 1 of 18

• Reboot.

Zend_Tool for OS X (Linux issimilar)
• Extract the downloaded archive file, ZendFramework-1.10.6-minimal.zip in your Downloads directory by double clicking on it. • Copy to /usr/local/ZendFrameworkCli by opening Terminal and typing: sudo cp -r ~/Downloads/ZendFramework-1.10.6-minimal /usr/local/ ZendFrameworkCli • Edit your bash profile to provide an alias: • From Terminal, type: open ~/.bash_profile • Add aliaszf=/usr/local/ZendFrameworkCli/bin/zf.sh to the end of the file • Save and exit TextEdit. • Exit Terminal.

Testing Zend_Tool
You can test your installation of the Zend_Tool command line interface by opening a Terminal or Command Prompt and typing:
! zf show version

If all has worked, you should see:
! Zend Framework Version: 1.10.0

If not, then check you set up the path correctly and that the bindirectory exists in the ZendFrameworkCli directory. Once the zf tool is working, zf --help will show you all the commands available. Note: If your PHP distribution ships with Zend Framework, please check that it isnʼt using ZF 1.9 as this tutorial will not work. At the time of writing, the xxamp distribution did this.

The tutorial application
Now that all the pieces are in place that we canbuild a Zend Framework application, letʼs look at the application that we are going to build. We are going to build a very simple inventory system to display our CD collection. The main page will list our collection and allow us to add, edit and delete CDs. As with any software engineering, it helps if we do a little pre-planning. We are going to need four pages in our website: Home page Add New...
Ler documento completo

Por favor, assinar para o acesso.

Estes textos também podem ser interessantes

  • Iniciando com o zend framework
  • Criando a Primeira Aplicação com o Zend Framework 2
  • Zend
  • Frameworks
  • Framework
  • Framework
  • Frameworks
  • Frameworks

Seja um membro do Trabalhos Feitos