PHPackages                             j4s/superglobals - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. j4s/superglobals

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

j4s/superglobals
================

Classes for work with superglobals $\_GET, $\_POST, $\_SESSION, $\_COOKIE

1.0.0(6y ago)278[19 issues](https://github.com/j4s/superglobals/issues)1MITPHPPHP &gt;=7.0.0

Since Nov 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/j4s/superglobals)[ Packagist](https://packagist.org/packages/j4s/superglobals)[ Docs](https://github.com/j4s/superglobals)[ RSS](/packages/j4s-superglobals/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (13)Used By (1)

SuperGlobals
============

[](#superglobals)

v1.0.0

SuperGlobals is a PHP library for safe and convenient handling of SuperGlobals such as `$_GET`, `$_POST`, `$_SESSION`, `$_COOKIE`.

- 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 `Get::get('key');` instead of `isset($_GET['key']) ? $_GET['key'] : '';`
- put a default value as a second attribute like this: `Get::get('foo', 'bar');` this returns 'bar' when $\_GET\['foo'\] is not set.
- use methods like `Get::int('p');` for getting an integer value, for page number. If you want to use default "1" in this keys, you should write `Get::int('p', 1);`
- use the same interface for different SuperGlobals: `$_GET`, `$_POST`, `$_SESSION`, `$_COOKIE` (use `Get::get('foo');` for $\_GET\['foo'\], or `Cookie::get('foo');` for $\_COOKIE\['foo'\])

We have such a methods:

- **get(string $key, string $default = '')** : string - Returns the value of the `preset` key, or the `preset` default value.
- **int(string $key, int $default = 0)** : int - Returns the value of the `preset` key, if it is integer or the `preset` default value.
- **float(string $key, float $default = 0)** : float - Returns the value of the `preset` key, if it is float or the `preset` default value.
- **array(string $key, array $default = array())** : array - Returns the value of the `preset` key, if it is an array or the `preset` default value.
- **ident(string $key, string $default = '')** : string - Returns the value of the `preset` key, if it contains only this: a-zA-Z0-9\_- symbols, or the `preset` default value.
- **isDefined(string $key)** : bool - Returns `TRUE` if the the the `preset` key is defined, or `FALSE` if it is not.
- **isNull(string $key)** : bool - Returns `TRUE` if the value of the the `preset` key is not set, or `FALSE` otherwise.
- **isNotSet(string $key)** : bool - Returns `FALSE` if the value of the the `preset` key is not set, or `TRUE` otherwise.
- **is1(string $key)** : bool - Returns `TRUE` only if value of the $key == 1;
- **isEmpty(string $key, bool $ifNotSet = false)** : bool - Returns `TRUE` if value of the $key == ''

Current Diagram of classes: [![alt text](https://camo.githubusercontent.com/ed5df494f0609a2a3a7177f474d7a9fe9ce902a51a8b6e340d7af5ebfdbe6535/68747470733a2f2f79756d6c2e6d652f6469616772616d2f706c61696e3b6469723a74642f636c6173732f2535426a34732f7375706572676c6f62616c732f56616c69646174655375706572676c6f62616c734f724e6f7425374325374328292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732537432537436964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f47657425374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b617272617928293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e7465726661636525374325374367657428293b6973446566696e656428292535442c2535426a34732f7375706572676c6f62616c732f506f737425374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f53657373696f6e25374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b696e7428293b6973446566696e656428293b69734e756c6c28293b73657428293b666c6f617428293b69733128293b6964656e7428293b69734e6f7453657428293b6973456d70747928292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c496e7465726661636525374325374367657428293b6973446566696e656428292535442c2535426a34732f7375706572676c6f62616c732f436f6f6b696525374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f56616c69646174655375706572676c6f62616c734f724e6f742535442535452d2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f4765742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f4765742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f506f73742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f506f73742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f53657373696f6e2535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f53657373696f6e2535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f436f6f6b69652535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f436f6f6b6965253544)](https://camo.githubusercontent.com/ed5df494f0609a2a3a7177f474d7a9fe9ce902a51a8b6e340d7af5ebfdbe6535/68747470733a2f2f79756d6c2e6d652f6469616772616d2f706c61696e3b6469723a74642f636c6173732f2535426a34732f7375706572676c6f62616c732f56616c69646174655375706572676c6f62616c734f724e6f7425374325374328292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732537432537436964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f47657425374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b617272617928293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e7465726661636525374325374367657428293b6973446566696e656428292535442c2535426a34732f7375706572676c6f62616c732f506f737425374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f53657373696f6e25374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b696e7428293b6973446566696e656428293b69734e756c6c28293b73657428293b666c6f617428293b69733128293b6964656e7428293b69734e6f7453657428293b6973456d70747928292535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c496e7465726661636525374325374367657428293b6973446566696e656428292535442c2535426a34732f7375706572676c6f62616c732f436f6f6b696525374361727261794e616d653b696e707574436f6e7374616e743b636f6e766572744e756d6572696325374367657428293b6973446566696e656428293b6964656e7428293b69734e6f7453657428293b69734e756c6c28293b69733128293b696e7428293b6973456d70747928293b666c6f617428292535442c2535426a34732f7375706572676c6f62616c732f56616c69646174655375706572676c6f62616c734f724e6f742535442535452d2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f4765742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f4765742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f506f73742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f506f73742535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f53657373696f6e2535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f53657373696f6e2535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c732535442535452d2535426a34732f7375706572676c6f62616c732f436f6f6b69652535442c2535426a34732f7375706572676c6f62616c732f5375706572676c6f62616c537472696374496e746572666163652535442535452d2e2d2535426a34732f7375706572676c6f62616c732f436f6f6b6965253544)

---

#### Complies with standards:

[](#complies-with-standards)

- RSR v0.90.1 ()
- Semantic Versioning 2.0.0 ()

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Recently: every ~46 days

Total

12

Last Release

2549d ago

Major Versions

0.1.7 → v1.0.0-alpha2018-11-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb959b7cc29236c175fb0d5cacb3a40ba68b9c5cdc07b76f79cf7d0bf4c51241?d=identicon)[insolution4](/maintainers/insolution4)

---

Top Contributors

[![in4s](https://avatars.githubusercontent.com/u/28087198?v=4)](https://github.com/in4s "in4s (53 commits)")

---

Tags

cookiesgetpostsessionsuperglobalsvalidationvalidationsessioncookiesgetpostsuperglobalsfiltration

### Embed Badge

![Health badge](/badges/j4s-superglobals/health.svg)

```
[![Health](https://phpackages.com/badges/j4s-superglobals/health.svg)](https://phpackages.com/packages/j4s-superglobals)
```

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M671](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M416](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M106](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64236.9M185](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

8412.9M47](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
