Request final readonly class
Minn\Http\Request · public/minn/src/Minn/Http/Request.php · 145 lines
An immutable picture of the incoming request. Built once from the PHP globals at the edge; handlers only ever see this object.
Used by 87 (show)
Constants and properties
| prop | readonly Minn\Http\Method $method | Promoted from the constructor. |
| prop | readonly string $path | Promoted from the constructor. |
| prop | readonly array $query | Promoted from the constructor. |
| prop | readonly array $headers | Promoted from the constructor. |
| prop | readonly array $cookies | Promoted from the constructor. |
| prop | readonly string $body | Promoted from the constructor. |
| prop | readonly bool $secure | Promoted from the constructor. |
| prop | readonly string $host | Promoted from the constructor. |
| prop | readonly array $form | Promoted from the constructor. |
| prop | readonly array $files | Promoted from the constructor. |
| prop | readonly string $remoteAddress | Promoted from the constructor. |
| prop | readonly array $server | what the server says about itself: software, protocol, and address; diagnostics only Promoted from the constructor. |
Public
| new | __construct(Minn\Http\Method $method, string $path, array $query, array $headers, array $cookies, string $body, bool $secure, string $host, array $form = array ( ), array $files = array ( ), string $remoteAddress = '', array $server = array ( ))# |
| |||||||||||||||
| static | fromGlobals(): self# | The request PHP received, read once from the superglobals. | |||||||||||||||
| method | json(): array# | The JSON body as an array, or the form fields when the body is empty or a form. | |||||||||||||||
| method | withPath(string $path): self# | The same request addressed to another path (a REST route carried in ?rest_route=). | |||||||||||||||
| method | query(string $key, ?string $default = NULL): ?string# | One query value as a string, or the default when it is absent or not a string. | |||||||||||||||
| method | flag(string $key): bool# | A query value read as the reference reads a boolean argument: true, 1, yes, on; anything else is false. | |||||||||||||||
| method | flagged(string $key): bool# | A boolean the query or the body sets, as a DELETE may carry force in either (probes rest-posts-write, rest-terms-controller). | |||||||||||||||
| method | has(string $key): bool# | Whether the query carries this key at all, even empty. | |||||||||||||||
| method | header(string $name): ?string# | A request header by case-insensitive name, or null. | |||||||||||||||
| method | cookie(string $name): ?string# | A cookie's value, or null. | |||||||||||||||
| method | segments(): array# | The path split into non-empty segments: "/a/b/" becomes ["a", "b"]. | |||||||||||||||
| method | queryStringWithout(string ...$keys): string# | The query string with the given keys removed, ready to append to a redirect. |
Nothing matches.