agrandesr/router

This is a KISS router and I try to keep it simple.

0.1 2024-02-11 12:21 UTC

This package is auto-updated.

Last update: 2025-04-22 10:17:02 UTC


README

Requirements:

  • PHP >7.4
  • Composer (vendor autoload)

To install you execute:

composer install ...

To start to use add the routes in your index.php file.

require 'vendor/autoload.php';

use Agrandesr\Http\Router;

Router::use('', 'Agrandesr\EasyRouter\Controllers\User'); //Function default main
Router::use('get','Agrandesr\EasyRouter\Controllers\User::get');
Router::use('update','Agrandesr\EasyRouter\Controllers\User::update');

If you want to create relative path you can use brackets.

Router::use('update/{id}','Agrandesr\EasyRouter\Controllers\User::update');

Next, you can use this relative path with the static function getOption.

$id = Router::getOption('id');