How to install Zend Framework 2 on XAMPP

I spent a bit of time to find out the proper way of installing Zend framework 2 on my Local XAMPP (Windows system). Here I described the proper way what I found to install Zend framework 2 without any difficulty for you.

XAMPP is the most popular PHP development environment. XAMPP is a completely free, easy to install Apache distribution containing MySQL, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to use.

Zend Framework 2 is an open source framework for developing web applications and services using PHP 5.3+. Zend Framework 2 uses 100% object-oriented code and utilities most of the new features of PHP, namely namespaces, late static binding, lambda functions and closures.

Highlights in Zend Framework 2:

  1. An entirely re-written event-driven MVC layer
  2. Components practice dependency injection, supported by our Service Locator and DiC components
  3. A powerful module management system
  4. An EventManager, for writing event-driven systems, as well as for creating cut points in your software for introducing cross-cutting concerns.
  5. A new view layer, architected around analyzing the request and generating a suitable response, be it plain old HTML, or Atom feeds or JSON.

zend framework 2

Step 1:

Zend framework 2 skeleton application is set up to use Composer to resolve its dependencies. Therefore, you need to install Composer if its not available in your system.

Composer installation procedure:

Download and run Composer setup executable file from: https://getcomposer.org/Composer-Setup.exe -it will install the latest composer version whenever it is executed.

During installation, please be careful to select php.exe (C:\xampp\php\php.exe) file from your current active PHP (i.e from XAMPP directory)

After installation, you can use ‘composer‘ command from any folder location.

Step 2:

Create your work directory under a XMAPP htdocs folder. C:\xampp\htdocs\zend

Step 3:

You need to create a new local domain to execute your project in a web browser. Open the local virtual host file C:\xampp\apache\conf\extra\httpd-vhosts.conf and insert the below lines

<VirtualHost *:80>
   ServerName zf2.localhost
   DocumentRoot C:\xampp\htdocs\zend\public
   SetEnv APPLICATION_ENV “development”
   <Directory C:\xampp\htdocs\zend\public>
     DirectoryIndex index.php
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>
</VirtualHost>

Step 4:

Configure local host file to activate above created virtue host domain. Open the host file C:\Windows\System32\drivers\etc\hosts and insert the below line

127.0.0.1 zf2.localhost

Step 5:

Open windows command prompt and navigate into your work directory

Open command prompt

command prompt navigation

Now install Zend Framework 2 using the below command

composer create-project -s dev zendframework/skeleton-application C:\xampp\htdocs\zend

zend framework installation command

It will take a bit of time to finish this installation. Once installation started you will get notification updates as below:

zend framework installation notification

Right click work directory and install composer ‘Composer Install‘ to rebuild with installed files.

composer install

composer install report

Now Zend Framework 2 skeleton application created without Zend library files.

Download latest Zend Framework 2 from the link http://framework.zend.com/downloads/latest

zend framework download

Once downloaded latest package, Extract it. You will get 2 folders with the name ‘Zend’ and ‘ZendXml’.

zf2 library

Now copy those 2 folders into your work directory under the folder ‘library’. (You need to create ‘library’ folder under your work ‘zend’ folder)

zf2 folder

that’s  it. Now Zend Framework 2 installed successfully in your local XAMPP.

Open your web browser and call the below URL

http://zf2.localhost

You will get the below default page.

zf2 localhost

Now you can start to work on this Zend Framework 2 application.

In case any clarification during installation, feel free to contact me with the email ‘gtechhub@gmail.com‘.

Leave a Reply

Your email address will not be published. Required fields are marked *