blob: fe546671c5b0559f1bfe6876fb99c8f34eecad98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
declare(strict_types=1);
namespace BrettParson\MiniRoute\Http;
/**
* Minimal HTTP request contract the router needs.
*
* Applications keep their own concrete Request class and implement this
* interface. The router only reads method/path and injects route parameters
* via withParams(); everything else stays application-owned.
*/
interface RequestInterface
{
public function method(): string;
public function path(): string;
/**
* Get a route parameter extracted by the router (e.g. {slug}).
*/
public function param(string $name, string $default = ''): string;
/**
* Return a copy of the request with route parameters attached.
*
* @param array<string, string> $params
*/
public function withParams(array $params): RequestInterface;
}
|