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)    
Last Updated Ratings Unique User Downloads Download Rankings
2022-09-20 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 104 This week: 3All time: 9,588 This week: 38Up
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

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:104
This week:3
All time:9,588
This week:38Up
User Comments (2)
Very well done!
6 hours ago (Roberto del Pino)
-
very easy and good work
18 days ago (Aladdin Masoud)
80%StarStarStarStarStar
 
For more information send a message to info at phpclasses dot org.