Creating and Running a Zend Framework Example Project
The purpose of the Zend Framework Example Project is to demonstrate
the capabilities and best practices of working with the Zend Framework.
Zend Framework
is a high quality open source framework for developing Web Applications
and Web Services with PHP. The Zend Framework Example Project is a small
demo application that shows how Zend Framework can be leveraged in order
to streamline writing code, by decreasing development time (through using
prewritten modules) and demonstrating how to implement best practices
in organizing your project.
Once the Example Project has been created, you will be able to navigate
through the tree in PHP Explorer and see the different components of the
project.
This project is a small application that
contains employee information, accessed through a login screen.
The Zend Framework
Example provides a model called MVC (Model-View-Controller) for programming
using the Framework. With this model, applications are divided into three
parts to assist in making the development process more efficient.
The
components are:
Controller -
includes all code that handles the logic.
Model - contains
data access commands to the raw data.
View - contains
the application's front end (User Interface).
Additional
information about programming with the Zend Framework can be found in
the official Zend Framework Manual at: http://framework.zend.com/manual
For more information
about the MVC method see http://en.wikipedia.org/wiki/Model-view-controller.
Creating the Zend Framework Example Project
|
|
|
|

|
To create a Zend Framework Example Project:
Go to File | New | Example
| Zend Framework Example Project.
The new Zend Framework Example Project wizard
will open.
Click
OK to create your project (leave the default name as ZendFrameworkExampleProject).
An example project will
be created and displayed in PHP Explorer view.
You can navigate through
the application source files to learn more about the source behind the
application.
See
'Running
the Zend Framework Example Project', below, to learn how to run the
application.
|
|
|
Running the
Zend Framework Example Project
Note:
The Zend Framework Example
project must be placed on a server configured to run Zend Framework. See
'Setting
Up Your Server Environment', below, to learn
more about configuring your server to enable Zend Framework project execution.
|
|
|
|

|
To run your Zend Framework Example Project:
Copy the Zend Framework
Example project to your server's document root.
Ensure the name of the project is 'ZendFrameworkExampleProject'.
In PHP Explorer view, right-click
"index.php" (located in the "www" folder of the ZendFrameworkExample
project) and select Run As | PHP Web Page.
The Run PHP Web Page dialog is displayed.
- Ensure the URL selected points
to the location of the index.php file on your server (by default, this
will be http://localhost/ZendFrameworkExampleProject/www/index.php).
Click OK.
A Path Mapping dialog might
appear asking you to select the local location of your Front Controller.
Select the Zend\Controller\Front.php file in your FRAMEWORK_HOME directory
and click OK.
The Demo Application will
appear in the Internal Browser.

To login to the application,
enter any user name and use the same name for the password.
You can now navigate through
the application.
|
|
|
Setting
Up Your Server Environment
Prerequisites:
* These
components can be installed together by installing Zend Core version 2.5.
However, if you are using an older version of Zend Core, you will need
to download the latest Zend Framework files from http://framework.zend.com/download.
The following instructions will guide
you through the process of setting up your server in order to be able
to run Zend Framework-based applications.
|
|
|
|

|
To run the Example Project, first set
up your server environment by following these steps:
If you do not have a server
running a PHP distribution already installed, you can install Zend Core (downloadable from http://www.zend.com/en/products/core).
Ensure you install with the following settings:
If
you do not have a Web server, install the Apache bundled with Zend Core.
If
you do not have the Zend Framework files already installed on your machine,
install Zend Core in 'Complete' mode, or ensure that Zend Framework is
selected in the list of additional components in 'Custom' mode.
If
you choose not to install Zend Core make sure you install the following:
PHP
5
Apache
2
Zend Framework files
(at least 0.93beta, downloadable from http://framework.zend.com/download).
Make
sure your php.ini settings are properly configured as follows: (These
can be configured through Zend Core or by manually configuring your php.ini
file)
Your
include path is pointing to your Zend Framework library (e.g. ;C:\Program
Files\Zend\Core\ZendFramework\library)
This is configured in the 'include_path' directive.
In Zend Core, this can be found under the 'Paths and Directories' category
in Configuration | PHP.
The
session settings are configured to save path points to a temporary directory
writable by the Web server (e.g."C:/temp" on Windows or "/tmp"
on UNIX / Linux.)
This is configured in the 'session.save_path'
directive.
In Zend Core, this can be found under the 'session-Session Management'
extension in Configuration | Extensions.
PHP
Short Tags are enabled.
This is configured in the short_open_tag directive.
In Zend Core, this cannot be disabled.
If
you want to display errors, set your display error setting to on.
This is configured in the display_errors directive.
In Zend Core, this can found under the 'Error Handling and Logging'
extension in Configuration | Extensions.
Restart
your Web server after applying changes.
|
|
You can now run your Zend Framework Example
project following the instructions under 'Running
the Zend Framework Example Project', above. |