2017 © Pedro Peláez
 

library globals

Globals

image

gcworld/globals

Globals

  • Friday, June 8, 2018
  • by GameCharmer
  • Repository
  • 1 Watchers
  • 1 Stars
  • 778 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 13 Versions
  • 142 % Grown

The README.md

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., (*1)

This implementation is a fork of the original Coercive/Globals available at https://github.com/Coercive/Globals, (*2)

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., (*3)

Note: This package contains a class used to ease transition pains that will conflict with the original., (*4)

Get

composer require gcworld/globals

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'] = '"';

# 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) """
*/


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

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

Supported Globals, (*5)

 COOKIE
 ENV
 FILES
 GET
 POST
 REQUEST
 SERVER
 SESSION

Available Filters, (*6)

->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, (*7)

# 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, (*8)

The Versions

08/06 2018

dev-master

9999999-dev http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

08/06 2018

2.0.5

2.0.5.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

08/06 2018

2.0.4

2.0.4.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

18/05 2018

2.0.3

2.0.3.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

16/05 2018

2.0.2

2.0.2.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

24/04 2018

2.0.1

2.0.1.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

19/04 2018

2.0

2.0.0.0 http://gamecharmer.com

Globals

  Sources   Download

MIT

The Requires

  • php >=7.1

 

by Avatar GameCharmer

07/02 2018

1.1

1.1.0.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

MIT

The Requires

  • php >=7.1

 

04/08 2017

1.0.4

1.0.4.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

GNU

The Requires

  • php >=7.0

 

04/08 2017

1.0.3

1.0.3.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

GNU

The Requires

  • php >=7.0

 

30/12 2016

1.0.2

1.0.2.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

GNU

The Requires

  • php >=7.0

 

04/12 2016

1.0.1

1.0.1.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

GNU

The Requires

  • php >=7.0

 

30/07 2016

1.0.0

1.0.0.0 http://coercive.fr

Coercive Globals Utility

  Sources   Download

GNU

The Requires

  • php >=7.0