| Recommend this page to a friend! | 
|  Download | 
| Info | Example |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
| Not yet rated by the users | Total: 95 | All time:  9,876 This week: 455  | ||||
| Version | License | PHP version | Categories | |||
| router 1.0 | MIT/X Consortium ... | 5 | HTTP, PHP 5, Libraries | 
| Description | Author | |
| This package can route requests by path to given action controllers. | 
| 
<?php | 
The simple route module.
_Installation_
~$composer require kolserdav/router
[Make catalog src/Controller ... Copy file src/Controller/TestController.php ... Copy file src/Controller/ErrorPage.php ... Rewrite namespaces ... Make catalog /config/route ... Copy file /config/route/routes.yaml] or call...
~$php vendor/kolserdav/router/install  
_Using_
You must use a single access point.
index.php
require 'vendor/autoload.php';
use Avir\Router\Route;
$router = new Route();
$router->route();
Add your routes in /config/route/routes.yaml
index :                                           
      path : /                                    
      controller: IndexController::indexPublic    
users :
      path : /users/
      controller : User\UserConroller::usersPublic
Create custom controllers with methods. _For example:_ IndexController::indexPublic User\UserConroller::usersPublic
When coinciding field 'path' with URI, the specified controller will be turned on. If URI contains of number, it will be available in the controller as...
class SomeClass
{
    public $id
    
    public function someFunction(){
        $this->id;
    }
} 
Also you can transfer parameters to URI
http://some.domains/some/uri/path?one=param1&two=param2&three=param3 //...
and catch them in the controller as
class SomeClass
{
    public $params;
    
    public function someFunction(){
        $this->params; //[ one : param1, two : param2, three : param3 ]
    }
} 
It's all... Very simple!
|  Files (13) | / | src | 
| File | Role | Description | ||
|---|---|---|---|---|
|  Controller (2 files) | ||||
|  Listener (1 file) | ||||
|  Respondent (2 files) | ||||
|  Driver.php | Class | Class source | ||
|  Route.php | Class | Class source | ||
|  RouteStation.php | Class | Class source | ||
|  Files (13) | / | src | / | Controller | 
| File | Role | Description | 
|---|---|---|
|  ErrorPage.php | Class | Class source | 
|  TestController.php | Class | Class source | 
|  Files (13) | / | src | / | Respondent | 
| File | Role | Description | 
|---|---|---|
|  responder.php | Aux. | Auxiliary script | 
|  Teletype.php | Class | Class source | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 100% | 
 | 
 | 
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.