Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 854 Bytes

File metadata and controls

57 lines (37 loc) · 854 Bytes

Router

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

License

MIT