Skip to content

Latest commit

 

History

History
44 lines (30 loc) · 1.51 KB

File metadata and controls

44 lines (30 loc) · 1.51 KB

InitPHP Router — Documentation

Welcome to the InitPHP Router documentation. Every page is self-contained and built around runnable examples.

Getting around

  1. Installation
  2. Getting started
  3. Configuration

Routing

  1. Routing — HTTP verbs, register(), add(), any()
  2. Route parameters & patterns:type vs {name}, custom patterns, optional segments
  3. Route groups — prefix, domain, port and client-IP grouping
  4. Controllers — handler formats and resource controllers
  5. Named routes & URLs — naming routes and generating URLs

Handling requests

  1. Dependency injection — handler arguments and PSR-11 containers
  2. Middleware — before/after filters
  3. Static file links — serving files and directories
  4. Error handling — 404 handling and exceptions
  5. Caching — caching the compiled route table

Migrating

  1. Upgrading from 1.x to 2.0

Throughout the docs, $router is an instance built like this:

use InitPHP\HTTP\Message\{Request, Response};
use InitPHP\Router\Router;

$router = new Router(Request::createFromGlobals(), new Response());

Any PSR-7 request/response pair works; InitPHP HTTP is used here for concreteness.