PHPackages                             gcworld/globals - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. gcworld/globals

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

gcworld/globals
===============

Globals

4.0.5(11mo ago)126.7k3MITPHPPHP &gt;=8.2

Since Jul 30Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/KongHack/Globals)[ Packagist](https://packagist.org/packages/gcworld/globals)[ Docs](http://gamecharmer.com)[ RSS](/packages/gcworld-globals/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (33)Used By (3)

Globals
=======

[](#globals)

GLOBALS allows you to easily manage your global variables in PHP by filtering the content automatically or specifically, with batch processing possible in case of array.

This implementation is a fork of the original Coercive/Globals available at

I've been using an override in composer.json for a while to use the fork over the original, but seeing as how they've diverged, felt it was a better idea to try and separate namespaces and packages.

Note: This package contains a class used to ease transition pains that will conflict with the original.

Get
---

[](#get)

```
composer require gcworld/globals

```

Usage
-----

[](#usage)

```
use GCWorld\Globals;

# LOAD
$oGlobals = new Globals;

# DEFAULT
$oGlobals->filter(true);
# You can turn off by setting 'false'

# SET VAR
$oGlobals->GET('name', 'value');

# GET VAR
$var = $oGlobals->GET('name');

# FOR EXAMPLE :
$_GET['array'] = ['email@email.email', 'not an email'];
$_GET['notInt'] = '01234';
$_GET['int'] = '14244';
$_GET['_int'] = '-14244';
$_GET['float'] = '142.24';
$_GET['_float'] = '+142.24';
$_GET['bool'] = 'false';
$_GET['_bool'] = true;
$_GET['quote'] = '&quot;';

# FILTER ALL
$var = $oGlobals->GET()->filterAll();

/**
      ["array"]
            [0]=> string(17) "email@email.email"
            [1]=> string(12) "not an email"
      ["notInt"]=> string(5) "01234"
      ["int"]=> int(14244)
      ["_int"]=> int(-14244)
      ["float"]=> float(142.24)
      ["_float"]=> float(142.24)
      ["bool"]=> bool(false)
      ["quote"]=> string(10) "&quot;"
*/

# FILTER ONE (including array of elements)
$var = $oGlobals->email()->GET('array');

/**
    ["array"]
        [0]=> string(17) "email@email.email"
        [1]=> bool(false)
*/
```

**Supported Globals**

```
 COOKIE
 ENV
 FILES
 GET
 POST
 REQUEST
 SERVER
 SESSION

```

**Available Filters**

```
->octal()->...
->int()->...
->float()->...
->bool()->...
->ip()->...
->ipv4()->...
->ipv6()->...
->callback(Callable $callback)->...
->json(bool $asArray)->...
->array()->...
->email()->...
->url()->...
->date()->...
->dateTime()->...
->mac()->...
->string()->...
->stringSpecial()->...
->stringFull()->...
->uuid()->...
->noFilter()->...

```

**Additional Features**

```
# You can filter a variable (or a part of global for re-inject)
$Result = $oGlobals->autoFilterManualVar($YourVar);

```

**Notes on Filters**

- The `string()` filter runs a trim(strip\_tags()) and may not be what you need. The `stringSpecial()` is the filter equivalent function
- The `callback` filter requires a callable. Previously, this just set the filter type and didn't function properly
- The `date()` and `dateTime` filters check against `strtotime($input) !== false` before translating to a Y-m-d( H:i:s) format

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance51

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 90.5% 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 ~104 days

Recently: every ~30 days

Total

32

Last Release

346d ago

Major Versions

1.1 → 2.02018-04-19

2.0.11 → 3.0.02020-04-20

3.3.0 → 4.0.02025-01-28

PHP version history (4 changes)1.0.0PHP &gt;=7.0

1.1PHP &gt;=7.1

3.2.0PHP &gt;=8.0

4.0.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![GameCharmer](https://avatars.githubusercontent.com/u/1208565?v=4)](https://github.com/GameCharmer "GameCharmer (57 commits)")[![Coercive](https://avatars.githubusercontent.com/u/20288080?v=4)](https://github.com/Coercive "Coercive (6 commits)")

### Embed Badge

![Health badge](/badges/gcworld-globals/health.svg)

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[getdkan/dkan

DKAN Open Data Catalog

385135.4k2](/packages/getdkan-dkan)[firefly-iii/data-importer

Firefly III Data Import Tool.

7545.8k](/packages/firefly-iii-data-importer)[tomaj/hermes

Simple php background processing library

38251.0k5](/packages/tomaj-hermes)

PHPackages © 2026

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