Skip to content
This repository was archived by the owner on Jan 1, 2020. It is now read-only.

Commit 9bd2b26

Browse files
committed
Merging develop to master in preparation for 3.0.0 release
2 parents 57c1011 + 2eec71f commit 9bd2b26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+6780
-12902
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ nbproject
77
.idea
88
.project
99
.settings
10-
vendor
10+
vendor/
1111
composer.phar
12+
config/development.config.php
13+
phpunit.xml

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM php:7.0-apache
2+
3+
RUN apt-get update \
4+
&& apt-get install -y git zlib1g-dev \
5+
&& docker-php-ext-install zip \
6+
&& a2enmod rewrite \
7+
&& sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/apache2.conf \
8+
&& mv /var/www/html /var/www/public \
9+
&& curl -sS https://getcomposer.org/installer \
10+
| php -- --install-dir=/usr/local/bin --filename=composer
11+
12+
WORKDIR /var/www

README.md

Lines changed: 127 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1,176 @@
1-
ZendSkeletonApplication
2-
=======================
1+
# ZendSkeletonApplication
32

4-
Introduction
5-
------------
6-
This is a simple, skeleton application using the ZF2 MVC layer and module
3+
## Introduction
4+
5+
This is a skeleton application using the Zend Framework MVC layer and module
76
systems. This application is meant to be used as a starting place for those
8-
looking to get their feet wet with ZF2.
7+
looking to get their feet wet with Zend Framework.
98

10-
Installation using Composer
11-
---------------------------
9+
## Installation using Composer
1210

13-
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).
11+
The easiest way to create a new Zend Framework project is to use
12+
[Composer](https://getcomposer.org/). If you don't have it already installed,
13+
then please install as per the [documentation](https://getcomposer.org/doc/00-intro.md).
1414

15+
To create your new Zend Framework project:
1516

16-
Create your new ZF2 project:
17+
```bash
18+
$ composer create-project -sdev zendframework/skeleton-application path/to/install
19+
```
1720

18-
composer create-project -n -sdev zendframework/skeleton-application path/to/install
21+
Once installed, you can test it out immediately using PHP's built-in web server:
1922

23+
```bash
24+
$ php -S 0.0.0.0:8080 -t public/ public/index.php
25+
```
2026

27+
This will start the cli-server on port 8080, and bind it to all network
28+
interfaces.
2129

22-
### Installation using a tarball with a local Composer
30+
**Note:** The built-in CLI server is *for development only*.
2331

24-
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:
32+
## Development mode
2533

26-
1. Download the [tarball](https://github.com/zendframework/ZendSkeletonApplication/tarball/master), extract it and then install the dependencies with a locally installed Composer:
34+
The skeleton ships with [zf-development-mode](https://github.com/zfcampus/zf-development-mode)
35+
by default, and provides three aliases for consuming the script it ships with:
2736

28-
cd my/project/dir
29-
curl -#L https://github.com/zendframework/ZendSkeletonApplication/tarball/master | tar xz --strip-components=1
30-
37+
```bash
38+
$ composer development-enable # enable development mode
39+
$ composer development-disable # enable development mode
40+
$ composer development-status # whether or not development mode is enabled
41+
```
3142

32-
2. Download composer into your project directory and install the dependencies:
43+
You may provide development-only modules and bootstrap-level configuration in
44+
`config/development.config.php.dist`, and development-only application
45+
configuration in `config/autoload/development.local.php.dist`. Enabling
46+
development mode will copy these files to versions removing the `.dist` suffix,
47+
while disabling development mode will remove those copies.
3348

34-
curl -s https://getcomposer.org/installer | php
35-
php composer.phar install
49+
## Running Unit Tests
3650

37-
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).
51+
To run the supplied skeleton unit tests, you need to do one of the following:
3852

39-
Web server setup
40-
----------------
53+
- During initial project creation, select to install the MVC testing support.
54+
- After initial project creation, install [zend-test](https://zendframework.github.io/zend-test/):
4155

42-
### PHP CLI server
56+
```bash
57+
$ composer require --dev zendframework/zend-test
58+
```
4359

44-
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
45-
directory:
60+
Once testing support is present, you can run the tests using:
4661

47-
php -S 0.0.0.0:8080 -t public/ public/index.php
62+
```bash
63+
$ ./vendor/bin/phpunit
64+
```
4865

49-
This will start the cli-server on port 8080, and bind it to all network
50-
interfaces.
66+
If you need to make local modifications for the PHPUnit test setup, copy
67+
`phpunit.xml.dist` to `phpunit.xml` and edit the new file; the latter has
68+
precedence over the former when running tests, and is ignored by version
69+
control. (If you want to make the modifications permanent, edit the
70+
`phpunit.xml.dist` file.)
5171

52-
**Note:** The built-in CLI server is *for development only*.
72+
## Using Vagrant
73+
74+
This skeleton includes a `Vagrantfile` based on ubuntu 14.04, and using the
75+
ondrej/php PPA to provide PHP 7.0. Start it up using:
76+
77+
```bash
78+
$ vagrant up
79+
```
80+
81+
Once built, you can also run composer within the box. For example, the following
82+
will install dependencies:
5383

54-
### Vagrant server
84+
```bash
85+
$ vagrant ssh -c 'composer install'
86+
```
5587

56-
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).
88+
While this will update them:
5789

58-
1. Run vagrant up command
90+
```bash
91+
$ vagrant ssh -c 'composer update'
92+
```
5993

60-
vagrant up
94+
While running, Vagrant maps your host port 8080 to port 80 on the virtual
95+
machine; you can visit the site at http://localhost:8080/
6196

62-
2. Visit [http://localhost:8085](http://localhost:8085) in your browser
97+
## Using docker-compose
6398

64-
Look in [Vagrantfile](Vagrantfile) for configuration details.
99+
This skeleton provides a `docker-compose.yml` for use with
100+
[docker-compose](https://docs.docker.com/compose/); it
101+
uses the `Dockerfile` provided as its base. Build and start the image using:
102+
103+
```bash
104+
$ docker-compose up -d --build
105+
```
106+
107+
At this point, you can visit http://localhost:8080 to see the site running.
108+
109+
You can also run composer from the image. The container environment is named
110+
"zf", so you will pass that value to `docker-compose run`:
111+
112+
```bash
113+
$ docker-compose run zf composer install
114+
```
115+
116+
## Web server setup
65117

66118
### Apache setup
67119

68120
To setup apache, setup a virtual host to point to the public/ directory of the
69121
project and you should be ready to go! It should look something like below:
70122

71-
<VirtualHost *:80>
72-
ServerName zf2-app.localhost
73-
DocumentRoot /path/to/zf2-app/public
74-
<Directory /path/to/zf2-app/public>
75-
DirectoryIndex index.php
76-
AllowOverride All
77-
Order allow,deny
78-
Allow from all
79-
<IfModule mod_authz_core.c>
80-
Require all granted
81-
</IfModule>
82-
</Directory>
83-
</VirtualHost>
123+
```apache
124+
<VirtualHost *:80>
125+
ServerName zf2-app.localhost
126+
DocumentRoot /path/to/zf2-app/public
127+
<Directory /path/to/zf2-app/public>
128+
DirectoryIndex index.php
129+
AllowOverride All
130+
Order allow,deny
131+
Allow from all
132+
<IfModule mod_authz_core.c>
133+
Require all granted
134+
</IfModule>
135+
</Directory>
136+
</VirtualHost>
137+
```
84138

85139
### Nginx setup
86140

87141
To setup nginx, open your `/path/to/nginx/nginx.conf` and add an
88142
[include directive](http://nginx.org/en/docs/ngx_core_module.html#include) below
89143
into `http` block if it does not already exist:
90144

91-
http {
92-
# ...
93-
include sites-enabled/*.conf;
94-
}
145+
```nginx
146+
http {
147+
# ...
148+
include sites-enabled/*.conf;
149+
}
150+
```
95151

96152

97153
Create a virtual host configuration file for your project under `/path/to/nginx/sites-enabled/zf2-app.localhost.conf`
98154
it should look something like below:
99155

100-
server {
101-
listen 80;
102-
server_name zf2-app.localhost;
103-
root /path/to/zf2-app/public;
104-
105-
location / {
106-
index index.php;
107-
try_files $uri $uri/ @php;
108-
}
109-
110-
location @php {
111-
# Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
112-
fastcgi_pass 127.0.0.1:9000;
113-
fastcgi_param SCRIPT_FILENAME /path/to/zf2-app/public/index.php;
114-
include fastcgi_params;
115-
}
156+
```nginx
157+
server {
158+
listen 80;
159+
server_name zf2-app.localhost;
160+
root /path/to/zf2-app/public;
161+
162+
location / {
163+
index index.php;
164+
try_files $uri $uri/ @php;
165+
}
166+
167+
location @php {
168+
# Pass the PHP requests to FastCGI server (php-fpm) on 127.0.0.1:9000
169+
fastcgi_pass 127.0.0.1:9000;
170+
fastcgi_param SCRIPT_FILENAME /path/to/zf2-app/public/index.php;
171+
include fastcgi_params;
116172
}
173+
}
174+
```
117175

118176
Restart the nginx, now you should be ready to go!

TODO.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# TODO
2+
3+
This is a TODO list for the feature/zend-mvc-v3-minimal branch.
4+
5+
## Documentation
6+
7+
- ModuleRouteListener is removed from the skeleton. This won't affect existing
8+
users, but *will* affect experienced users who originally relied on it being
9+
active in new skeleton projects.
10+
- The `/[:controller][/:action]]` route was removed from the skeleton. Again, it
11+
will not affect existing users, but *will* affect experienced users who
12+
originally relied on it being active in new skeleton projects.

Vagrantfile

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,25 @@
44
VAGRANTFILE_API_VERSION = '2'
55

66
@script = <<SCRIPT
7-
DOCUMENT_ROOT_ZEND="/var/www/zf/public"
7+
add-apt-repository ppa:ondrej/php
88
apt-get update
9-
apt-get install -y apache2 git curl php5-cli php5 php5-intl libapache2-mod-php5
10-
echo "
11-
<VirtualHost *:80>
12-
ServerName skeleton-zf.local
13-
DocumentRoot $DOCUMENT_ROOT_ZEND
14-
<Directory $DOCUMENT_ROOT_ZEND>
15-
DirectoryIndex index.php
16-
AllowOverride All
17-
Order allow,deny
18-
Allow from all
19-
</Directory>
20-
</VirtualHost>
21-
" > /etc/apache2/sites-available/skeleton-zf.conf
9+
apt-get install -y apache2 git curl php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-curl php7.0-intl php7.0-json php7.0-mbstring php7.0-opcache php7.0-soap php7.0-sqlite3 php7.0-xml php7.0-xsl php7.0-zip libapache2-mod-php7.0
10+
sed -i 's!/var/www/html!/var/www/public!g' /etc/apache2/sites-available/000-default.conf
2211
a2enmod rewrite
23-
a2dissite 000-default
24-
a2ensite skeleton-zf
2512
service apache2 restart
26-
cd /var/www/zf
27-
curl -Ss https://getcomposer.org/installer | php
28-
php composer.phar install --no-progress
29-
echo "** [ZEND] Visit http://localhost:8085 in your browser for to view the application **"
13+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
14+
if ! grep "cd /var/www" /home/vagrant/.profile > /dev/null; then
15+
echo "cd /var/www" >> /home/vagrant/.profile
16+
fi
17+
echo "** [ZF] Run the following command to install dependencies, if you have not already:"
18+
echo " vagrant ssh -c 'composer install'"
19+
echo "** [ZF] Visit http://localhost:8080 in your browser for to view the application **"
3020
SCRIPT
3121

3222
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
33-
config.vm.box = 'bento/ubuntu-14.04'
34-
config.vm.network "forwarded_port", guest: 80, host: 8085
35-
config.vm.hostname = "skeleton-zf.local"
36-
config.vm.synced_folder '.', '/var/www/zf'
23+
config.vm.box = 'ubuntu/trusty64'
24+
config.vm.network "forwarded_port", guest: 80, host: 8080
25+
config.vm.synced_folder '.', '/var/www'
3726
config.vm.provision 'shell', inline: @script
3827

3928
config.vm.provider "virtualbox" do |vb|

0 commit comments

Comments
 (0)