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 | ||||
66% | 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
Files (14) |
File | Role | Description | ||
---|---|---|---|---|
src (2 directories) | ||||
vendor (1 file, 1 directory) | ||||
composer.json | Data | Auxiliary data | ||
index.php | Example | Example script | ||
README.md | Doc. | Documentation | ||
rewriterConfig.php | Aux. | Auxiliary script |
Files (14) | / | src | / | Router |
File | Role | Description |
---|---|---|
Route.php | Class | Class source |
Router.php | Class | Class source |
RouterException.php | Class | Class source |
Files (14) | / | vendor | / | composer |
File | Role | Description |
---|---|---|
autoload_classmap.php | Aux. | Auxiliary script |
autoload_namespaces.php | Aux. | Auxiliary script |
autoload_psr4.php | Aux. | Auxiliary script |
autoload_real.php | Class | Class source |
ClassLoader.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% |
|
|
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.