Alpha ZealPHP is early-stage and under active development. APIs may change between minor versions until v1.0. Feedback and bug reports welcome on GitHub.
API Index — Namespaces, Packages, Reports, Indices

MergeSlashesMiddleware
in package
implements MiddlewareInterface

Merge Slashes Middleware — Apache MergeSlashes On / nginx merge_slashes.

Collapses runs of consecutive slashes in the request path to a single slash before routing, so /a//b///c matches the same route as /a/b/c. This is an internal rewrite (no redirect) — it mutates $g->server['REQUEST_URI'], which the router reads. The query string is left untouched (only the path is normalized). Register it ahead of route-dependent middleware.

Apache enables this by default; ZealPHP matches the raw path unless this middleware is registered.

Usage in app.php: $app->addMiddleware(new \ZealPHP\Middleware\MergeSlashesMiddleware());

Table of Contents

Interfaces

MiddlewareInterface

Methods

process()  : ResponseInterface

Methods

process()

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface
On this page