zend-framework2 Installation or Setup


Detailed instructions on getting Zend Framework 2 set up or installed. There are various ways of installing the framework. Below are some of them:

Using Composer - Recommended way

Assuming composer is installed on the target box.

To install a skeleton MVC application, run in your terminal to create a new zend framework 2 project in specified location:

php composer.phar create-project -sdev \
    --repository-url="https://packages.zendframework.com" \
    zendframework/skeleton-application path/to/install

to manually install a minimal ZF2 (Zend MVC + its handful of dependencies), run in your command line:

composer require zendframework/zend-mvc

or for a full-fledged ZF2 (+64 modules):

composer require zendframework/zendframework`

Please note that the first option runs an installer that will provide you with a fully-functionnal application along with the usual application directories structure. Other options will let you build the whole application from scratch as it simply provides ZF2 modules to build upon.

Using Git Submodules

Run the command below to clone zf2 and it's dependencies recursively from Github:

git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive

HTTP Server Setup

A typical web application requires a running a HTTP service listening a dedicated port (usually :80) to pass incoming requests to application, process and serve the output (response) back.

Note: You can also write console-aware applications in Zend Framework 2 without a need to a HTTP server.


The simplest way to get started if you are using PHP 5.4 or above is to start the internal PHP cli-server in the root directory.

Go to project directory and run:

php -S -t public/ public/index.php`.

This will start the builtin cli-server on port 8080, and bind it to all network interfaces.

OPTION 2 - A custom HTTP Server

Configure a virtualhost on Apache or Microsoft IIS Server or Nginx and pass incoming HTTP requests to the application.