RequestViewHelpers
final class RequestViewHelpers (View source)
Exposes request-local URL, old-input and flash operations to rendered views.
Constants
| private OLD_INPUT_NAMESPACE |
|
Methods
Captures one request and optional default-session state for the renderer's active scope.
Resolves canonical session old input before flash and caller fallbacks.
Pulls one transient value from the optional flash bag.
Returns the active request path without its query string.
Returns the active request query string without a leading question mark.
Returns the active request path with an optional query string.
Returns an absolute request URL only through the configured safe origin resolver.
Compares a URL against the active path using exact or prefix matching.
Generates a route URL and compares it with the active request path.
Details
__construct
__construct(ServerRequestInterface $request, UrlGenerator $urlGenerator, FlashBagInterface|null $flash = null, SessionInterface|null $session = null, callable|null $absoluteUrl = null)
Captures one request and optional default-session state for the renderer's active scope.
old
mixed
old(string $key, mixed $default = '')
Resolves canonical session old input before flash and caller fallbacks.
flash
mixed
flash(string $key, mixed $default = null)
Pulls one transient value from the optional flash bag.
currentPath
string
currentPath()
Returns the active request path without its query string.
currentQuery
string
currentQuery()
Returns the active request query string without a leading question mark.
currentUrl
string
currentUrl(bool $withQuery = true)
Returns the active request path with an optional query string.
currentFullUrl
string
currentFullUrl(bool $withQuery = true)
Returns an absolute request URL only through the configured safe origin resolver.
isUrlActive
bool
isUrlActive(string $url, bool $startsWith = false)
Compares a URL against the active path using exact or prefix matching.
isRouteActive
bool
isRouteActive(string $route, array $params = [], bool $startsWith = false)
Generates a route URL and compares it with the active request path.