PHP Classes

Simple PHP Router Library: Route requests to different scripts based on URLs

Recommend this page to a friend!
  Info   View files Example   View files View files (12)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-21 (23 days ago) RSS 2.0 feedStarStarStarStar 79%Total: 555 This week: 7All time: 5,445 This week: 106Up
Version License PHP version Categories
folderbase-php-route 0.13GNU General Publi...5HTTP, PHP 5, Files and Folders, Desig...
Description Author

This class can route requests to different scripts based on URLs.

It takes an array of supported routes and checks it to see if the current request URL matches any of the routes.

The class can route the requests to the respective script defined in the routes array.

Missing routes makes the class handle the request with a not found script.

Recommendations

url rewriting
I need rewrite url in my site

Picture of afshin akhgar
  Performance   Level  
Name: afshin akhgar <contact>
Classes: 3 packages by
Country: Iran Iran
Innovation award
Innovation award
Nominee: 1x

Details

Folderbase PHP Router!

[AUR]()

A lightweight and simple object oriented PHP Router. Built by Afshin Akhgar- http://www.akhgar.net

Features

  • Static Route
  • Dynamic Route
  • Parameter Support => akhgar.net/param1/a/param2/b
  • Folder and file and subfolders routing
  • Subrouting
  • Parameter sending over url and query String Support
  • Custom 404 handling
  • Works fine in subfolders > Note: > - This Library is under development

<i class="icon-file"></i> Demo

  • First of all get the lib
  • Include it in your php index file
  • Call The router go Method
GLOBAL $includePath;
GLOBAL $assetsUrl;
$includePath = '/';
				
require_once './lib/router.php';
$router = new Router();
return $router->go(array(
	'afshin'=>'examples/afshin.php',
	'/'=>'examples/afshin.php',
	'/sub/:param1/:param2/:param3:/param:4'=>'examples/params.php',
));

<i class="icon-file"></i> Parameter

'/sub/:param1/:param2/:param3:/param:4'=>'examples/params.php'

get Parameters with Array ($parameters)
  Files folder image Files  
File Role Description
Files folder imageexamples (2 files, 1 directory)
Files folder imagelib (1 file)
Accessible without login Plain text file .htaccess Data Auxiliary data
Accessible without login Plain text file 404.php Aux. Auxiliary script
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file _config.yml Data Auxiliary data

  Files folder image Files  /  examples  
File Role Description
Files folder imagesub (1 file, 1 directory)
  Accessible without login Plain text file afshin.php Aux. Auxiliary script
  Accessible without login Plain text file test.php Aux. Auxiliary script

  Files folder image Files  /  examples  /  sub  
File Role Description
Files folder imagesubsub (1 directory)
  Accessible without login Plain text file iran.php Aux. Auxiliary script

  Files folder image Files  /  examples  /  sub  /  subsub  
File Role Description
Files folder imagemodule (2 files)

  Files folder image Files  /  examples  /  sub  /  subsub  /  module  
File Role Description
  Accessible without login Plain text file module.php Aux. Auxiliary script
  Accessible without login Plain text file param.php Aux. Auxiliary script

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:555
This week:7
All time:5,445
This week:106Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:79%StarStarStarStar
Rank:37
  
For more information send a message to info at phpclasses dot org.