Get
in package
Query parameter accessor for GET requests.
Provides type-safe access to $_GET parameters with optional default values. Encapsulates parameter names to prevent direct $_GET access and enable consistent parameter handling.
Usage:
$name = new Get('name');
$value = $name->v('John'); // Returns $_GET['name'] or 'John'
Tags
Table of Contents
Properties
- $key : string
Methods
- __construct() : mixed
- Initialize a GET parameter accessor.
- v() : string|null
- Retrieve a GET parameter value with optional default.
Properties
$key read-only
protected
string
$key
Methods
__construct()
Initialize a GET parameter accessor.
public
__construct(string $key) : mixed
Parameters
- $key : string
-
The parameter name/key to access from $_GET.
v()
Retrieve a GET parameter value with optional default.
public
v([string|null $default = null ]) : string|null
Parameters
- $default : string|null = null
-
Default value if the parameter is not present.
Return values
string|null —The parameter value or default value.