Posted by & filed under Uncategorized.

Prerequisites:

  • Git
  • PHP
  • Apache/NGINX/Zend Server

Assumptions:

  • Web server is configured

From a command line interface (CLI), change to the working directory you would like to have contain your project and clone Zend’s skeleton application into the folder. If you have already setup a web server with PHP support you may want to place the project into the root directory of the web server so that you may be able to easily access the application for testing. 

git clone https://github.com/zendframework/ZendSkeletonApplication

With the application cloned you can try to navigate to the application via a web browser.  You will be met with an error:

Zend Skeleton Application error after cloning the project

Zend Skeleton Application error after cloning the project

We still need to load the Zend framework into the project. Move your working directory into the Zend Skeleton application’s directory then run:

php composer.phar self-update
php composer.phar update

The first command updates composer.phar and the second makes sure the dependencies are loaded. If the dependencies are not loaded they are retrieved. You should now be able to load the page and see:

Zend skeleton application after loading the Zend framework

Zend skeleton application after loading the Zend framework

With the skeleton application up and running the next logical step would seem to be running through the Zend Album tutorial located at http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html. I like to put my own spin on it to make it a little more scalable.

One Response to “Setup a ZF2 Skeleton Application”

  1. kelsey9649

    After setting up the skeleton application you may want to declare the default timezone for the application. You may do this in the application’s public/index.php file. For example, I added:
    date_default_timezone_set('America/Chicago');
    to the beginning of my public/index.php file.

    Reply

What do you really think?