In this tutorial I will explain the steps for Zend Framework 2 Installation via Composer.
Steps for install Zend Framework 2 Installation via Composer
- First set environment variable D:\xampp\php in Advanced system settings.
- Download and install composer from https://getcomposer.org/Composer-Setup.exe
once you installed automatically composer variable will be added into environment variables (C:\ProgramData\ComposerSetup\bin;) - Now download and install git from http://msysgit.github.io/
Like below screenshot, select 2nd option when you install.Once you installed automatically git variable will be added into environment variables
(C:\Program Files\Git\cmd) - To check git is installed correctly and configured, just press right click and you will see below screen
Now click on Git Bash Here and you will see below screen.
- Now to check composer and php are configured correctly by running below commands.
open Git Bash
$ composer –version or $ composer –v
$ php –version or $ php -v - Now create a directory in your htdocs like say “zendapp”
Then we have to create composer.phar in this directory
Go to
d:\>cd xampp/htdocs/zendapp
d:\xampp\htdocs\zendapp>php -r "readfile('https://getcomposer.org/installer');" | php
Then composer.phar file will be created in zendapp folder.
- Now download the zend 2.2.7 skeleton from https://github.com/zendframework/ZendSkeletonApplication by changing branch/tags to 2.2.7 and put these files in zendapp folder.
- Now run following commands to update composer and install framework.
php composer.phar self-update php composer.phar install
- Next in D:\xampp\apache\conf\extra\httpd-vhosts.conf add below lines:
NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot "D:/xampp/htdocs/zendapp/public" ServerName www.zendapp.inc ServerAlias zendapp.inc <Directory "D:/xampp/htdocs/zendapp/public"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
- Next in C:\Windows\System32\drivers\etc\hosts file add below line:
127.0.0.1 www.zendapp.inc zendapp.inc
- Finally, once you restart your apache and run www.zendapp.inc you will see below screen.