This repository has been archived by the owner on Jan 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merging develop to master in preparation for 3.0.0 release
- Loading branch information
Showing
96 changed files
with
6,780 additions
and
12,902 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,7 @@ nbproject | |
.idea | ||
.project | ||
.settings | ||
vendor | ||
vendor/ | ||
composer.phar | ||
config/development.config.php | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM php:7.0-apache | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y git zlib1g-dev \ | ||
&& docker-php-ext-install zip \ | ||
&& a2enmod rewrite \ | ||
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/apache2.conf \ | ||
&& mv /var/www/html /var/www/public \ | ||
&& curl -sS https://getcomposer.org/installer \ | ||
| php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
WORKDIR /var/www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,176 @@ | ||
ZendSkeletonApplication | ||
======================= | ||
# ZendSkeletonApplication | ||
|
||
Introduction | ||
------------ | ||
This is a simple, skeleton application using the ZF2 MVC layer and module | ||
## Introduction | ||
|
||
This is a skeleton application using 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. | ||
looking to get their feet wet with Zend Framework. | ||
|
||
Installation using Composer | ||
--------------------------- | ||
## Installation using Composer | ||
|
||
The easiest way to create a new ZF2 project is to use [Composer](https://getcomposer.org/). If you don't have it already installed, then please install as per the [documentation](https://getcomposer.org/doc/00-intro.md). | ||
The easiest way to create a new Zend Framework project is to use | ||
[Composer](https://getcomposer.org/). If you don't have it already installed, | ||
then please install as per the [documentation](https://getcomposer.org/doc/00-intro.md). | ||
|
||
To create your new Zend Framework project: | ||
|
||
Create your new ZF2 project: | ||
```bash | ||
$ composer create-project -sdev zendframework/skeleton-application path/to/install | ||
``` | ||
|
||
composer create-project -n -sdev zendframework/skeleton-application path/to/install | ||
Once installed, you can test it out immediately using PHP's built-in web server: | ||
|
||
```bash | ||
$ 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. | ||
|
||
### Installation using a tarball with a local Composer | ||
**Note:** The built-in CLI server is *for development only*. | ||
|
||
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: | ||
## Development mode | ||
|
||
1. Download the [tarball](https://github.com/zendframework/ZendSkeletonApplication/tarball/master), extract it and then install the dependencies with a locally installed Composer: | ||
The skeleton ships with [zf-development-mode](https://github.com/zfcampus/zf-development-mode) | ||
by default, and provides three aliases for consuming the script it ships with: | ||
|
||
cd my/project/dir | ||
curl -#L https://github.com/zendframework/ZendSkeletonApplication/tarball/master | tar xz --strip-components=1 | ||
|
||
```bash | ||
$ composer development-enable # enable development mode | ||
$ composer development-disable # enable development mode | ||
$ composer development-status # whether or not development mode is enabled | ||
``` | ||
|
||
2. Download composer into your project directory and install the dependencies: | ||
You may provide development-only modules and bootstrap-level configuration in | ||
`config/development.config.php.dist`, and development-only application | ||
configuration in `config/autoload/development.local.php.dist`. Enabling | ||
development mode will copy these files to versions removing the `.dist` suffix, | ||
while disabling development mode will remove those copies. | ||
|
||
curl -s https://getcomposer.org/installer | php | ||
php composer.phar install | ||
## Running Unit Tests | ||
|
||
If you don't have access to curl, then install Composer into your project as per the [documentation](https://getcomposer.org/doc/00-intro.md). | ||
To run the supplied skeleton unit tests, you need to do one of the following: | ||
|
||
Web server setup | ||
---------------- | ||
- During initial project creation, select to install the MVC testing support. | ||
- After initial project creation, install [zend-test](https://zendframework.github.io/zend-test/): | ||
|
||
### PHP CLI server | ||
```bash | ||
$ composer require --dev zendframework/zend-test | ||
``` | ||
|
||
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: | ||
Once testing support is present, you can run the tests using: | ||
|
||
php -S 0.0.0.0:8080 -t public/ public/index.php | ||
```bash | ||
$ ./vendor/bin/phpunit | ||
``` | ||
|
||
This will start the cli-server on port 8080, and bind it to all network | ||
interfaces. | ||
If you need to make local modifications for the PHPUnit test setup, copy | ||
`phpunit.xml.dist` to `phpunit.xml` and edit the new file; the latter has | ||
precedence over the former when running tests, and is ignored by version | ||
control. (If you want to make the modifications permanent, edit the | ||
`phpunit.xml.dist` file.) | ||
|
||
**Note:** The built-in CLI server is *for development only*. | ||
## Using Vagrant | ||
|
||
This skeleton includes a `Vagrantfile` based on ubuntu 14.04, and using the | ||
ondrej/php PPA to provide PHP 7.0. Start it up using: | ||
|
||
```bash | ||
$ vagrant up | ||
``` | ||
|
||
Once built, you can also run composer within the box. For example, the following | ||
will install dependencies: | ||
|
||
### Vagrant server | ||
```bash | ||
$ vagrant ssh -c 'composer install' | ||
``` | ||
|
||
This project supports a basic [Vagrant](http://docs.vagrantup.com/v2/getting-started/index.html) configuration with an inline shell provisioner to run the Skeleton Application in a [VirtualBox](https://www.virtualbox.org/wiki/Downloads). | ||
While this will update them: | ||
|
||
1. Run vagrant up command | ||
```bash | ||
$ vagrant ssh -c 'composer update' | ||
``` | ||
|
||
vagrant up | ||
While running, Vagrant maps your host port 8080 to port 80 on the virtual | ||
machine; you can visit the site at http://localhost:8080/ | ||
|
||
2. Visit [http://localhost:8085](http://localhost:8085) in your browser | ||
## Using docker-compose | ||
|
||
Look in [Vagrantfile](Vagrantfile) for configuration details. | ||
This skeleton provides a `docker-compose.yml` for use with | ||
[docker-compose](https://docs.docker.com/compose/); it | ||
uses the `Dockerfile` provided as its base. Build and start the image using: | ||
|
||
```bash | ||
$ docker-compose up -d --build | ||
``` | ||
|
||
At this point, you can visit http://localhost:8080 to see the site running. | ||
|
||
You can also run composer from the image. The container environment is named | ||
"zf", so you will pass that value to `docker-compose run`: | ||
|
||
```bash | ||
$ docker-compose run zf composer install | ||
``` | ||
|
||
## Web server setup | ||
|
||
### 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: | ||
|
||
<VirtualHost *:80> | ||
ServerName zf2-app.localhost | ||
DocumentRoot /path/to/zf2-app/public | ||
<Directory /path/to/zf2-app/public> | ||
DirectoryIndex index.php | ||
AllowOverride All | ||
Order allow,deny | ||
Allow from all | ||
<IfModule mod_authz_core.c> | ||
Require all granted | ||
</IfModule> | ||
</Directory> | ||
</VirtualHost> | ||
```apache | ||
<VirtualHost *:80> | ||
ServerName zf2-app.localhost | ||
DocumentRoot /path/to/zf2-app/public | ||
<Directory /path/to/zf2-app/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](http://nginx.org/en/docs/ngx_core_module.html#include) below | ||
into `http` block if it does not already exist: | ||
|
||
http { | ||
# ... | ||
include sites-enabled/*.conf; | ||
} | ||
```nginx | ||
http { | ||
# ... | ||
include sites-enabled/*.conf; | ||
} | ||
``` | ||
|
||
|
||
Create a virtual host configuration file for your project under `/path/to/nginx/sites-enabled/zf2-app.localhost.conf` | ||
it should look something like below: | ||
|
||
server { | ||
listen 80; | ||
server_name zf2-app.localhost; | ||
root /path/to/zf2-app/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/zf2-app/public/index.php; | ||
include fastcgi_params; | ||
} | ||
```nginx | ||
server { | ||
listen 80; | ||
server_name zf2-app.localhost; | ||
root /path/to/zf2-app/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/zf2-app/public/index.php; | ||
include fastcgi_params; | ||
} | ||
} | ||
``` | ||
|
||
Restart the nginx, now you should be ready to go! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# TODO | ||
|
||
This is a TODO list for the feature/zend-mvc-v3-minimal branch. | ||
|
||
## Documentation | ||
|
||
- ModuleRouteListener is removed from the skeleton. This won't affect existing | ||
users, but *will* affect experienced users who originally relied on it being | ||
active in new skeleton projects. | ||
- The `/[:controller][/:action]]` route was removed from the skeleton. Again, it | ||
will not affect existing users, but *will* affect experienced users who | ||
originally relied on it being active in new skeleton projects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.