Recommend this page to a friend! |
![]() |
Info | Example | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() ![]() | Total: 57 | All time: 10,566 This week: 96![]() |
Version | License | PHP version | Categories | |||
routers 1.0.0 | GNU General Publi... | 5 | HTTP, PHP 5, Design Patterns |
Description | Author | |
This package can route HTTP requests to given callback functions. |
<?php |
>Examples
<?php use App\Router\Router;
$router = new App\Router\Router($_SERVER["REQUEST_URI"]); $router->get('/',function(){
echo 'home page';
});
$router->get('/posts/:id-:slug',function($id, $slug) use ($router){
echo $router->url('Blog#show',['id'=>1,'slug'=>'slugsd-idads']);
},'posts.show')->with('id','[0-9]+')->with('slug','([a-z\-0-9]+)');
$router->get('/posts/:id','Blog#show');
$router->post('/posts/:id',function($id){
print_r($_POST); });
$router->run();
$router->get('/posts','Blog#show');
Create new Controller BlogController.php
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Example | Example script | ||
![]() ![]() |
Doc. | Documentation | ||
![]() ![]() |
Aux. | Auxiliary script |
![]() |
/ | src | / | Router |
File | Role | Description |
---|---|---|
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
/ | vendor | / | composer |
File | Role | Description |
---|---|---|
![]() ![]() |
Aux. | Auxiliary script |
![]() ![]() |
Aux. | Auxiliary script |
![]() ![]() |
Aux. | Auxiliary script |
![]() |
Class | Class source |
![]() |
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. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
User Ratings | ||||||||||||||||||||||||||||||
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.