diff --git a/.gitignore b/.gitignore
index 9c256bd..88bfaac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ vendor/
phpdoc/
# Code coverage report
+coverage/
report/
# Sphinx Documentation
diff --git a/docker-compose.yml b/docker-compose.yml
index b4ac5c5..767276c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,7 @@
version: '2'
services:
+ # PHPUnit and Composer
php:
build:
context: .
@@ -8,9 +9,24 @@ services:
volumes:
- .:/usr/local/src/wellrested
+ # Documentation generator
docs:
build:
context: .
dockerfile: ./docker/docs/Dockerfile
volumes:
- - .:/usr/local/src/wellrested
\ No newline at end of file
+ - .:/usr/local/src/wellrested
+
+ # Local development site
+ nginx:
+ image: nginx:1.13
+ ports:
+ - 8080:80
+ volumes:
+ - .:/usr/local/src/wellrested
+ - ./docker/nginx/site.conf:/etc/nginx/conf.d/default.conf
+
+ php-fpm:
+ image: php:7.1-fpm
+ volumes:
+ - .:/usr/local/src/wellrested
diff --git a/docker/nginx/site.conf b/docker/nginx/site.conf
new file mode 100644
index 0000000..c0def51
--- /dev/null
+++ b/docker/nginx/site.conf
@@ -0,0 +1,26 @@
+server {
+ listen 80;
+
+ root /usr/local/src/wellrested/public;
+ index index.php index.html;
+ charset utf-8;
+
+ access_log /var/log/nginx/access.log;
+ error_log /var/log/nginx/error.log;
+
+ # Front Controller
+ location / {
+ try_files $uri $uri/ /index.php?$args;
+ }
+
+ # PHP
+ location ~ \.php$ {
+ include fastcgi_params;
+ fastcgi_pass php-fpm:9000;
+ fastcgi_index index.php;
+ fastcgi_buffers 8 8k;
+ fastcgi_buffer_size 16k;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME index.php;
+ }
+}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index a5088c5..5ed29fc 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -24,6 +24,6 @@
To run unit tests, run:
+docker-compose run --rm php phpunit
+ View the code coverage report.
+ +To generate documentation, run:
+docker-compose run --rm docs
+ View documentation.
+ + +HTML; + + return (new Response(200)) + ->withHeader('Content-type', 'text/html') + ->withBody(new Stream($view)); + } +} + +// ----------------------------------------------------------------------------- + +$server = new Server(); + +// Add a router to the server to map methods and endpoints to handlers. +$router = $server->createRouter(); +$router->register("GET", "/", new HomePageHandler()); +$server->add($router); + +// Read the request from the client, dispatch a handler, and output. +$server->respond();