Get
Provides raw and typed access to GET parameters, with controlled mutation of the request parameter container.
Typed parameter access
Typed getters provide explicit conversions and defined fallback values for invalid inputs. Use the GET controller when the parameter must come specifically from the query string.
No direct superglobals
Do not access or modify $_GET directly in application code.
Example
$get = Registry::get(Get::class);
$page = $get->getInt('page');
Public API Reference
Core\Get
Class & Registry
Class:
Core\Get
Extends:
Core\Get\Base
use Core\Get;
use Core\Registry;
$get = Registry::get(Get::class);
| Method | Description |
|---|---|
init():void |
Initializes the GET parameter controller for accessing HTTP query string parameters. |
get(string $key):mixed |
Returns the raw GET parameter value for the specified key, or null if the
key does not exist.
|
getString(string $key, string $default = ''):string |
Returns a GET parameter converted to a string, or the specified default if the parameter is missing or cannot be converted. |
getInt(string $key, int $default = 0):int |
Returns a GET parameter converted to an integer, or the specified default if the parameter is missing or cannot be converted. |
getFloat(string $key, float $default = 0.0):float |
Returns a GET parameter converted to a float, or the specified default if the parameter is missing or cannot be converted. |
getBool(string $key, bool $default = false):bool |
Returns a GET parameter converted to a boolean, or the specified default if the parameter is missing or cannot be converted. |
getArray(string $key, array $default = []):array |
Returns a GET parameter as an array, or the specified default if the parameter is missing or cannot be converted. |
getAll():array |
Returns all currently available GET parameters as an associative array. |
has(string $key):bool |
Checks whether the specified GET parameter exists. |
set(string $key, mixed $value):void |
Sets or overwrites a GET parameter value in the current request data. |
remove(string $key):void |
Removes the specified GET parameter from the current request data. |
clear():void |
Removes all GET parameters from the current request data. |