Download .zip |
Info | Example | View files (13) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2018-06-14 (2 months ago) | Not yet rated by the users | Total: Not yet counted | Not yet ranked |
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. |
|
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 | / | 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 | / | src | / | Controller |
File | Role | Description |
---|---|---|
ErrorPage.php | Class | Class source |
TestController.php | Class | Class source |
Files | / | src | / | Respondent |
File | Role | Description |
---|---|---|
responder.php | Aux. | Auxiliary script |
Teletype.php | Class | Class source |
Version Control | Unique User Downloads | |||||||
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.