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   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-09-20 (9 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 96 This week: 41All time: 9,698 This week: 3Up
Version License PHP version Categories
router_app 1.0.2Free for non-comm...5HTTP, PHP 5, Design Patterns
Description Author

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: 52
All time rank: 436849 in Egypt Egypt
Week rank: 4 Up1 in Egypt Egypt Up

Details

routerApp

  • 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 README.md 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  
 88%
Total:96
This week:41
All time:9,698
This week:3Up
For more information send a message to info at phpclasses dot org.