indexdotphp

A small php framework.

Built for PHP 8.3+ — typed params, sub-routers, and middleware without PSR ceremony.

  1. Typed path parameters with built-in and custom decoders
  2. Sub-routers that inherit middleware and decoders
  3. Onion-model middleware, global or per-route
  4. Auto OPTIONS / HEAD, normalized trailing slashes
  5. Pagination baked into the response envelope

Installation

composer require fabianmossberg/indexdotphp

Usage

use IndexDotPhp\Router\Request;
use IndexDotPhp\Router\Response;
use IndexDotPhp\Router\Router;

$router = new Router();

$router->get('/hello/:name', [], fn(): Response => Response::ok([
    'greeting' => 'Hello, ' . Request::param('name'),
]));

$router->dispatch()->send();