mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-17 00:37:52 +00:00
Updated documentation
This commit is contained in:
@@ -49,12 +49,17 @@ This is an example of a basic ```index.php``` file:
|
||||
```php
|
||||
use \Pecee\SimpleRouter\SimpleRouter;
|
||||
|
||||
require_once 'routes.php'; // change this to whatever makes sense in your project
|
||||
// Load external routes file
|
||||
require_once 'routes.php';
|
||||
|
||||
// The apps default namespace (so we don't have to specify it each time we use MyController@home)
|
||||
/*
|
||||
* The default namespace for route-callbacks, so we don't have to specify it each time.
|
||||
* Can be overwritten by using the namespace config option.
|
||||
*/
|
||||
|
||||
SimpleRouter::setDefaultNamespace('MyWebsite\Controller');
|
||||
|
||||
// Do the routing
|
||||
// Start the routing
|
||||
SimpleRouter::start();
|
||||
```
|
||||
|
||||
|
||||
@@ -106,7 +106,6 @@ class RouterBase {
|
||||
$mergedSettings = array();
|
||||
|
||||
/* @var $route RouterEntry */
|
||||
/* @var $group RouterGroup */
|
||||
for($i = 0; $i < count($routes); $i++) {
|
||||
|
||||
$route = $routes[$i];
|
||||
@@ -148,6 +147,7 @@ class RouterBase {
|
||||
|
||||
if ($route->matchRoute($this->request)) {
|
||||
|
||||
/* @var $group RouterGroup */
|
||||
$group = $route;
|
||||
|
||||
$mergedSettings = array_merge($settings, $group->getMergeableSettings());
|
||||
@@ -214,11 +214,11 @@ class RouterBase {
|
||||
|
||||
$routeNotAllowed = false;
|
||||
|
||||
$this->request->rewrite_uri = $this->request->uri;
|
||||
$this->request->rewrite_uri = $this->request->getUri();
|
||||
$this->request->setUri($originalUri);
|
||||
|
||||
$this->request->loadedRoute = $route;
|
||||
$route->loadMiddleware($this->request);
|
||||
$this->request->loadedRoute->loadMiddleware($this->request);
|
||||
|
||||
$this->request->loadedRoute->renderRoute($this->request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user