PHP Classes

PHP Router Class Package: Handle HTTP requests routing to controller classes

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 69 This week: 1All time: 10,266 This week: 560Up
Version License PHP version Categories
php-router-class 1.0.0BSD License5HTTP, PHP 5, Design Patterns
Description 

Author

This package can handle HTTP requests routing to controller classes.

It provides a router class that can register the HTTP request URL patterns it can handle and the controller paths associated with each HTTP URL pattern.

There is a request class that can retrieve the HTTP request variables.

The router class can process the current request and route it to a controller class that matches the current request URL pattern.

Picture of Vitalij Mik
  Performance   Level  
Name: Vitalij Mik <contact>
Classes: 7 packages by
Country: Germany Germany
Age: 37
All time rank: 3497195 in Germany Germany
Week rank: 411 Up15 in Germany Germany Up
Innovation award
Innovation award
Nominee: 5x

Example

<?php
error_reporting
(E_ALL);

require_once
__DIR__ . '/Router.php';
require_once
__DIR__ . '/Request.php';

$router = require_once __DIR__ . '/routes.php';

$request = Request::createFromGlobal();

try{
    echo
$router->handle($request);
}catch (
RouteNotFoundException $exception){
    echo
$exception->getMessage();
}


  Files folder image Files  
File Role Description
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file index.php Example Example script
Plain text file IndexController.php Class Class source
Plain text file ProfileController.php Class Class source
Plain text file Request.php Class Class source
Plain text file RouteNotFoundException.php Class Class source
Plain text file Router.php Class Class source
Accessible without login Plain text file routes.php Conf. Configure the application URL patterns and controller classes

 Version Control Unique User Downloads Download Rankings  
 100%
Total:69
This week:1
All time:10,266
This week:560Up