PHP Classes

How to Implement a PHP Router Script using the Router App: Route HTTP requests to given PHP scripts

Recommend this page to a friend!
  Info   View files Example   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 125 All time: 9,376 This week: 126Up
Version License PHP version Categories
router_app 1.0.2Free for non-comm...5HTTP, PHP 5, Design Patterns


This package can route HTTP requests to given PHP scripts.

It can register multiple URL patterns and an HTTP request method (GET or POST) that an application is accepting requests.

The package can load a PHP script to execute when it processes a HTTP request when the request URL matches one of the registered URL patterns.

If the current HTTP request does not match any of the registered URL patterns, the package can load and execute a script to handle HTTP status code 404 if that script exists.

Picture of Aladdin
Name: Aladdin <contact>
Classes: 1 package by
Country: Egypt Egypt
Age: 53
All time rank: 432649 in Egypt Egypt
Week rank: 333 Up3 in Egypt Egypt Up



  • This is a simple and powerful Router App like frameworks
  • first build your page as you want and need inside components directory .. like home.php or login.php or any you want
  • I just biuld home.php, about.php and contact.php for example
  • then make a new instance for Router Class
  • then use get($route, $pathToFile); for get method
  • or use post($route, $pathToFile); for post method
  • then run();
  • as like in index.php
  • note: any route doesn't installed as like in index.php .. it will response and render a 404 not found page
  Files folder image Files  
File Role Description
Files folder imagecomponents (5 files)
Files folder imageRouter (1 file)
Plain text file .htaccess Aux. useful magic server tool
Plain text file index.php Example Example script
Plain text file Doc. Documentation

  Files folder image Files  /  components  
File Role Description
  Plain text file about.php Aux. Auxiliary script
  Plain text file contact.php Aux. Auxiliary script
  Plain text file home.php Aux. Auxiliary script
  Plain text file index.php Aux. Auxiliary script
  Plain text file _404.php Aux. Auxiliary script

  Files folder image Files  /  Router  
File Role Description
  Plain text file Router.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,376
This week:126Up
User Comments (2)
Very well done!
11 months ago (Roberto del Pino)
very easy and good work
11 months ago (Aladdin Masoud)