anujsinghwd / anrouter
A simple and small routing library
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/anujsinghwd/anrouter
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2025-10-26 11:44:54 UTC
README
A simple and small PHP Routing
Installation
composer require anujsinghwd/anrouter
Usage
-
First configure
.htaccessRewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . index.php [L]
-
$anrouter = new AnRouter() -
Simply make function according to your route
Example
- index.php File
require_once './lib/AnRouter.php'; $anrouter = new AnRouter(); $anrouter->get('method_name'); -> For GET REQUEST $anrouter->post('method_name'); -> For POST REQUEST $anrouter->put('method_name'); -> For PUT REQUEST $anrouter->delete('method_name'); -> For DELETE REQUEST function method_name() { echo "Method Called"; }
- Above route called by
(http://your_base_url/method_name)
Parameter Handling
- Pass with request
$anrouter->get('method_name', array('agr1' => $val))
- Getting the Parameter in function
function method_name($param) { echo $param; }