A routing library for PHP

1.0 2020-04-14 19:52 UTC

This package is auto-updated.

Last update: 2024-04-21 04:31:13 UTC


README

Latest Stable Version License

Features

  • Easy to use
  • Supports GET, POST, PUT, PATCH, DELETE & OPTIONS verbs
  • Supports Route Parameters (Regex support)
  • Middleware
  • Route Groups
  • Reverse Routing (Generate URL from Route Name)
  • Subdirectory Routing
  • Error Routes
  • Implement Custom Resolver & Dispatcher

Installation

composer require adrianschubek/router

Example

use adrianschubek\Routing\Route;
use adrianschubek\Routing\Router;

$r = new Router();

$r->get("/", function () {
    echo "Hello stranger!";
});

$r->get("/[a]/[b]", function ($a, $b) {
    echo $a + $b;
})->where("([0-9]+)");

$r->dispatch();