Compare commits

...

6 Commits

Author SHA1 Message Date
Simon Sessingø 0df469184c Merge pull request #22 from skipperbent/development
[BUGFIX] Fixed Exceptions due to route null value.
2015-10-30 02:28:40 +01:00
Simon Sessingø 649ed28a91 [BUGFIX] Fixed Exceptions due to route null value. 2015-10-30 02:27:44 +01:00
Simon Sessingø 5cb7086e96 Merge pull request #21 from skipperbent/development
Development
2015-10-28 05:04:45 +01:00
Simon Sessingø a2edc1504c [BUGFIX] Fixed regular expression matching after last release. 2015-10-28 05:04:11 +01:00
Simon Sessingø d31cda8e70 Merge pull request #20 from skipperbent/master
Latest master
2015-10-27 17:49:08 +01:00
Simon Sessingø 921f050a31 Update README.md 2015-10-27 17:48:35 +01:00
3 changed files with 7 additions and 5 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
# Simple PHP router
Simple, fast PHP router that is easy to get integrated and in almost any project. Heavily inspired by the Laravel router.
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the Laravel router.
## Installation
Add the latest version pf Simple PHP Router to your ```composer.json```
@@ -33,7 +33,7 @@ Add the latest version pf Simple PHP Router to your ```composer.json```
- Global Constraints
- Sub-Domain Routing
- Required parameters
- Optional parameters
## Initialising the router
+2 -2
View File
@@ -253,7 +253,7 @@ class RouterBase {
throw new \InvalidArgumentException('Invalid type for getParams. Must be array or null');
}
if($controller === null && $parameters === null) {
if($controller === null && $parameters === null && $this->loadedRoute !== null) {
return $this->processUrl($this->loadedRoute, null, $getParams);
}
@@ -295,7 +295,7 @@ class RouterBase {
$method = $tmp[1];
}
if($controller === $c) {
if($controller === $c && $route !== null) {
return $this->processUrl($route, $method, $parameters, $getParams);
}
}
+3 -1
View File
@@ -49,7 +49,7 @@ class RouterRoute extends RouterEntry {
// Check if url parameter count matches
if(stripos($url, $routeMatch) === 0) {
$matches = (count(explode('/', rtrim($url, '/'))) == count(explode('/', rtrim($route, '/'))));
$matches = true;
if($this->regexMatch) {
$parameters = $this->parseParameters($url, true, $this->regexMatch);
@@ -61,6 +61,8 @@ class RouterRoute extends RouterEntry {
} else {
$matches = (count(explode('/', rtrim($url, '/'))) == count(explode('/', rtrim($route, '/'))));
$url = explode('/', $url);
$route = explode('/', rtrim($route, '/'));