steodec / router
This package is abandoned and no longer maintained.
The author suggests using the humbrain/php-project package instead.
Router use by Micro Framework
2.2
2022-06-17 08:53 UTC
Requires
- php: >=8.0
- haydenpierce/class-finder: 0.4.3
README
A simple anotation router for PHP8.
Installation
Use the package manager composer to install Router.
composer require Steodec\Router
Usage
index.php
namespace Steodec\App; use Steodec\Router /** * @params string namespace */ RouterConfig::run("Steodec\Controllers");
controller.php
namespace Steodec\Controllers; use Steodec\Router class Home { #[Routes(method:'GET', path: "/")] public function index() { echo "Hello World"; } }
Documentation
The Route attribute can take several parameters
method
:"GET" | "PUT" | "POST" | "DELETE"
path: it is a string "/" it can take parameters ": parameter"
Example:
"/user/:id"
is_granted: Takes a string as a parameter, work if you have roles system