pijush_gupta/php-router

Simple Php Router

dev-main 2022-12-29 17:28 UTC

This package is auto-updated.

Last update: 2025-06-29 02:00:29 UTC


README

Php Router

Clone this repository
git clone https://github.com/Pijushgupta/php-router.git
Adding it to the project
include_once 'Location of file';
OR use Composer/auto-loader
composer require pijush_gupta/php-router:dev-main
Using it in the project
use phpRouter\Router;
new Router('/', function () {
	echo 'Home';
});
Get method with Parameters
https://example.com?a=Pijush&b=Gupta
new Router('/',function($a,$b){ //exact number of variables and name as query vars from url.
	echo $a . $b;
})
Post method
https://example.com/
new Router('/',function($post){ //variable name for the param can be anything
	var_dump($post);
});