Installation
ZF2 requires PHP 5.3.3 or higher, so make sure you have the latest version of PHP.
We need a Windows-based PC, and we will be using XAMPP (http://www.apachefriends.org/en/xampp.html) for our development setup. I have installed XAMPP on my D:
drive, so my web root path for my setup is d:\xampp\htdocs
.
Step 1 – downloading Zend Framework
To create a ZF2 project, we will need two things: the framework itself and a skeleton application. Download both Zend Framework and the skeleton application from http://framework.zend.com/downloads/latest and https://github.com/zendframework/ZendSkeletonApplication, respectively.
Step 2 – unzipping the skeleton application
Now put the skeleton application that you have just downloaded into the web root directory (d:\xampp\htdocs
) and unzip it. Name the directory address-book
as we are going to create a very small address book application, or you can name it anything you want your project name to be. When you unzip the skeleton application, it looks similar to the following screenshot:
Step 3 – knowing the directories
Inside the module
directory, there is a default module called Application
. Inside the vendor
directory, there is an empty directory called ZF2
. This directory is for the Zend Framework library.
Unzip the Zend Framework that you have downloaded, and copy the library
folder from the unzipped folder to the vendor\ZF2
directory.
Step 4 – welcome to Zend Framework 2
Now, in your browser, type: http://localhost/address-book/public
. It should show a screen as shown in the following screenshot. If you see the same screen, it means you have created the project successfully.
And that’s it
By this point, you should have a working Zend Framework, and you are free to play around and discover more about it.