Friday, January 24, 2014

How To Set-up ZendFramework 2 for Developers from Scratch

Here are a few easy steps to bootstrap your development using Zend Framework 2.x. This assumes that you are using PHP 5.3.x or higher on a *nix machine. Was tested to work on Fedora and CentOS.

1) Install composer

(make sure you are a root user)
# sudo -i
# curl -sS | php -- --install-dir=/usr/local/src/
# mv /usr/local/src/composer.phar /usr/local/bin/composer

# chmod +x /usr/local/bin/composer

2) Download and install ZendFramework Skeletion Application

# composer create-project --repository-url="" zendframework/skeleton-application /path/to/install/skeleton/app dev-master

3) Create your Apache virtual host (or any web server for that matter which you can easily find tutorials - search google: configure NGINX virtual host).

Add your vhost configuration file by copying the sample virtual host configuration to a vhost file. The file path may vary depending on your OS and filesystem setup.

# vim /etc/httpd/conf.d/vhosts/

<VirtualHost *:80>
        DocumentRoot /path/to/install/skeleton/app/public
        ServerAdmin root@localhost
        ErrorLog logs/
        CustomLog logs/ common
        SetEnv APPLICATION_ENV local
        <Directory /path/to/install/skeleton/app>
                Order deny,allow
                Allowoverride All
# /etc/init.d/httpd configtest
If everything is in order, restart Apache
# /etc/init.d/httpd restart

4) Add entry to your local host file, so you can check the skeleton App from your browser.

# vim /etc/hosts

5) Check your running ZF2 skeleton Application from your browser.

6) Add your setup to you favorite SCM tool (SVN or Git)

# cd /path/to/install/skeleton/app
SVN: svn import -m "importing ulaptech files for the first time"
Git: git init; git commit -m "initial commit"; git add remote origin; git push origin master;

7) Point your skeleton app to your favorite PHP IDE/Editor - PhpStorm, NetBeans, SublimeText, Eclipse etc.

8) Start coding :)

  • Related Links Widget for Blogspot

No comments: