alkimisti / simplerouter
A simple PSR-4 router
Installs: 41
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alkimisti/simplerouter
Requires
- php: ~7.2
Requires (Dev)
- phpunit/phpunit: >=8.0
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2025-10-11 07:59:54 UTC
README
This package is a simple PSR-4 router for PHP.
Install
Via Composer
$ composer require alkimisti/simplerouter:dev-main
Usage
$router = new Router(); $router->resolve();
The first URL segment will be used as the name of the controller; /home will instantiate App\Controllers\HomeController.php.
The second URL segment will be used as the name of the action/method; /home/index will invoke index() method in App\Controllers\HomeController.
Other segments will be forwarded as method arguments; /products/show/5 will invoke show() method in App\Controllers\ProductsController, passing the number 5 as its first argument.
Tutorial: https://codemolecules.com/php/a-simple-psr-4-router-for-php/
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Credits
- [Tahir Hoxha][link-author]
- [All Contributors][link-contributors]
License
The MIT License (MIT). Please see License File for more information.