Skip to content

A simple PSR-4 router.

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

tasouza/simplerouter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Simple Router

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.

About

A simple PSR-4 router.

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%