diff --git a/README.md b/README.md
index e70b77b..d0c77a8 100644
--- a/README.md
+++ b/README.md
@@ -30,12 +30,28 @@ If your script lives in a subfolder e.g. /api/v1 set this basepath in your run m
Do not forget to edit the basepath in .htaccess too if you are on Apache2. In order to run the test files correctly inside a basepath you should also adjust the navigation links inside the index.php.
+## Enable case sensitive routes and trailing slashes
+The second and third parameters of ```Route::run('/', false, false);``` are both set to false by default.
+You can enable case sensitive mode by setting the second parameter to true.
+By default the router will ignore trailing slashes. Set the third parameter to true to avoid this.
+
## Something does not work?
* Dont forget to set the correct basepath as argument in your run method and in your .htaccess file.
* Enable mod_rewrite in your Apache2 settings
-## Test setup
-There is a little Vagrant test setup. Just run ```vagrant up``` to spin up a Apache2 Webserver on Ubuntu. Then navigate to http://router.local after adding the machine IP to your hosts file.
+## Test setup with Docker
+I have created a little Docker test setup.
+
+1. Build the image: ```docker build -t simplephprouter docker/image```
+
+2. Spin up a container
+ * On Linux / Mac or Windows Powershell use: ```docker run -d -p 80:80 -v $(pwd):/var/www/html --name simplephprouter simplephprouter```
+ * On Windows CMD use ```docker run -d -p 80:80 -v %cd%:/var/www/html --name simplephprouter simplephprouter```
+
+3. Open your browser and navigate to http://localhost
+
+## Test setup with Vagrant (not longer maintained)
+There is a little Vagrant test setup. Just run ```vagrant up``` to spin up a Apache2 Webserver on Ubuntu. Then navigate to http://router.local after adding the machine IP to your hosts file. This test setup is not longer maintained and will probably break in future. Use the docker test setup instead.
## Todo
* Create demo configuration for nginx
diff --git a/Route.php b/Route.php
index 5495cee..b529fb9 100644
--- a/Route.php
+++ b/Route.php
@@ -22,13 +22,17 @@ class Route{
self::$methodNotAllowed = $function;
}
- public static function run($basepath = '/'){
+ public static function run($basepath = '/', $case_matters = false, $trailing_slash_matters = false){
// Parse current url
$parsed_url = parse_url($_SERVER['REQUEST_URI']);//Parse Uri
if(isset($parsed_url['path']) && $parsed_url['path'] != '/'){
- $path = rtrim($parsed_url['path'], '/');
+ if($trailing_slash_matters){
+ $path = $parsed_url['path'];
+ }else{
+ $path = rtrim($parsed_url['path'], '/');
+ }
}else{
$path = '/';
}
@@ -57,8 +61,8 @@ class Route{
// echo $route['expression'].'
';
- // Check path match
- if(preg_match('#'.$route['expression'].'#',$path,$matches)){
+ // Check path match
+ if(preg_match('#'.$route['expression'].'#'.($case_matters ? '':'i'),$path,$matches)){
$path_match_found = true;
diff --git a/docker/image/Dockerfile b/docker/image/Dockerfile
new file mode 100644
index 0000000..fe78a2f
--- /dev/null
+++ b/docker/image/Dockerfile
@@ -0,0 +1,3 @@
+FROM php:7.2-apache
+
+RUN a2enmod rewrite
diff --git a/index.php b/index.php
index 8909a37..4cb7711 100644
--- a/index.php
+++ b/index.php
@@ -1,44 +1,57 @@
-
-Navigation:
-