Download the PHP package j4s/superglobals without Composer
On this page you can find all versions of the php package j4s/superglobals. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download j4s/superglobals
More information about j4s/superglobals
Files in j4s/superglobals
Package superglobals
Short Description Classes for work with superglobals $_GET, $_POST, $_SESSION, $_COOKIE
License MIT
Homepage https://github.com/j4s/superglobals
Informations about the package superglobals
SuperGlobals
v1.0.0
SuperGlobals is a PHP library for safe and convenient handling of SuperGlobals such as , , , .
- Safe because you can use special methods to validate or filter requested value "on the fly"
- Convenient because it makes application code short and meaningful, without useless repetitions, making it ''extra'' DRY
Using this library you can:
-
write instead of
-
put a default value as a second attribute like this: this returns 'bar' when $_GET['foo'] is not set.
-
use methods like for getting an integer value, for page number. If you want to use default "1" in this keys, you should write
-
use the same interface for different SuperGlobals: , , , (use for $_GET['foo'], or for $_COOKIE['foo'])
We have such a methods:
-
get(string $key, string $default = '') : string - Returns the value of the key, or the default value.
-
int(string $key, int $default = 0) : int - Returns the value of the key, if it is integer or the default value.
-
float(string $key, float $default = 0) : float - Returns the value of the key, if it is float or the default value.
-
array(string $key, array $default = array()) : array - Returns the value of the key, if it is an array or the default value.
-
ident(string $key, string $default = '') : string - Returns the value of the key, if it contains only this: a-zA-Z0-9_- symbols, or the default value.
-
isDefined(string $key) : bool - Returns if the the the key is defined, or if it is not.
-
isNull(string $key) : bool - Returns if the value of the the key is not set, or otherwise.
-
isNotSet(string $key) : bool - Returns if the value of the the key is not set, or otherwise.
-
is1(string $key) : bool - Returns only if value of the $key == 1;
-
isEmpty(string $key, bool $ifNotSet = false) : bool - Returns if value of the $key == ''
Complies with standards:
- RSR v0.90.1 (https://github.com/in4s/NewRepo/)
- Semantic Versioning 2.0.0 (https://semver.org/)