Skip to content
docsv0.1.0

HttpMethod

The typed HTTP-verb vocabulary. Replaces every stringly-typed method ('GET', 'GET|POST', the 'ALL' magic string): routes, the `#[Route]` attribute, and match results all speak this enum, never a raw string. A zero-dependency primitive at the package root because every routing type uses it.

HttpMethod::isSafe()

public function isSafe(): bool

Whether the method is "safe" — read-only, with no expected server state change (RFC 9110): GET, HEAD, OPTIONS and TRACE.

HttpMethod::isIdempotent()

public function isIdempotent(): bool

Whether repeating the request has the same effect as making it once (RFC 9110): every safe method, plus PUT and DELETE.

HttpMethod::cases()

public static function cases(): array

HttpMethod::from()

public static function from(string|int $value): static

Parameters

Parameters of from()
NameTypeDescription
$valuestring|int

HttpMethod::tryFrom()

public static function tryFrom(string|int $value): ?static

Parameters

Parameters of tryFrom()
NameTypeDescription
$valuestring|int