ZFSkeleton by vrkansagara
, (*1)
, (*2)
Introduction
This is a simple, skeleton application based on the Zend Framework MVC layer and module
systems. This application is meant to be used as a starting place for those
looking to get their feet wet with ZF2., (*3)
Installation using Composer
The easiest way to create a new ZF2 project is to use Composer. If you don't have it already installed, then please install as per the documentation., (*4)
Create your new ZF2 project:, (*5)
$ composer create-project -n -sstable vrkansagara/ZFSkeleton path/to/install
OR you can use, (*6)
$ composer require zendframework/zendframework
Installation using a tarball with a local Composer
If you don't have composer installed globally then another way to create a new ZF2 project is to download the tarball and install it:, (*7)
-
Download the tarball, extract it and then install the dependencies with a locally installed Composer:, (*8)
cd my/project/dir
curl -#L https://github.com/vrkansagara/ZFSkeleton/tarball/master| tar xz --strip-components=1
-
Download composer into your project directory and install the dependencies:, (*9)
curl -s https://getcomposer.org/installer | php
php composer.phar install
If you don't have access to curl, then install Composer into your project as per the documentation., (*10)
PHP CLI 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:, (*11)
php -S 0.0.0.0:8080 -t public/ public/index.php
This will start the cli-server on port 8080, and bind it to all network
interfaces., (*12)
Note: The built-in CLI server is for development only., (*13)
Vagrant server
This project supports a basic Vagrant configuration with an inline shell provisioner to run the Skeleton Application in a VirtualBox., (*14)
-
Run vagrant up command, (*15)
vagrant up, (*16)
-
Visit http://localhost:8085 in your browser, (*17)
Look in Vagrantfile for configuration details., (*18)
Apache setup
To setup apache, setup a virtual host to point to the public/ directory of the
project and you should be ready to go! It should look something like below:, (*19)
<VirtualHost *:80>
ServerName ZFSkeleton.localhost
DocumentRoot /path/to/ZFSkeleton/public
<Directory /path/to/ZFSkeleton/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Directory>
</VirtualHost>
Nginx setup
To setup nginx, open your /path/to/nginx/nginx.conf
and add an
include directive below
into http
block if it does not already exist:, (*20)
http {
# ...
include sites-enabled/*.conf;
}
Create a virtual host configuration file for your project under /path/to/nginx/sites-enabled/ZFSkeleton.localhost.conf
it should look something like below:, (*21)
server {
listen 80;
server_name ZFSkeleton.localhost;
root /path/to/ZFSkeleton/public;
location / {
index index.php;
try_files $uri $uri/ @php;
}
location @php {
# Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /path/to/ZFSkeleton/public/index.php;
include fastcgi_params;
}
}
Restart the nginx, now you should be ready to go!, (*22)
- File issues at https://github.com/vrkansagara/ZFSkeleton/issues
- Documentation is at https://github.com/vrkansagara/ZFSkeleton/wiki