Download the PHP package gcworld/globals without Composer

On this page you can find all versions of the php package gcworld/globals. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package globals

GCWorld Globals

Packagist Packagist

Packagist PHP Packagist GitHub

GCWorld Globals provides a typed, filterable access layer for PHP superglobals. It supports automatic scalar coercion, explicit validation and sanitization, recursive array filtering, JSON decoding, UUID conversion, and configurable default values.

Version

4.1.0

Requirements

Installation

Basic Usage

Each explicit filter applies to the next value read. Filter state resets after the read, including when a callback throws. When multiple filters are selected before a read, the most recently selected filter wins.

Supported Superglobals

The following methods provide access to their corresponding PHP superglobals:

Method Superglobal
COOKIE() $_COOKIE
ENV() $_ENV
FILES() $_FILES
GET() $_GET
POST() $_POST
REQUEST() $_REQUEST
SERVER() $_SERVER
SESSION() $_SESSION

The target superglobal must exist as an array. For example, initialize the PHP session before using SESSION() in environments where $_SESSION has not yet been created.

Reading and writing values

Set operations return true when the selected global is available. Reads of a missing value return null unless defaults are enabled.

Inspecting and filtering a complete global

filterAll() recursively applies automatic filtering. filterNone() returns the selected global without changing its values.

Automatic Filtering

Automatic filtering is enabled by default for reads that do not select an explicit filter. It recognizes:

Automatic filtering can be disabled persistently for individual reads:

Use noFilter() when only the next read should bypass validation, sanitization, and type coercion:

The configured UTF-8 conversion still applies to string values returned by noFilter().

Values outside a superglobal can use the same automatic behavior:

Explicit Filters

Filter Behavior
octal() Converts an octal string to an integer
int() Validates and returns an integer
float() Validates and returns a float
bool() Validates and returns a boolean
ip() Validates an IPv4 or IPv6 address
ipv4() Validates an IPv4 address
ipv6() Validates an IPv6 address
email() Validates an email address
url() Validates a URL
mac() Validates a MAC address
string() Trims the value and removes HTML tags
stringStrict() Keeps letters, numbers, spaces, apostrophes, and hyphens
stringSpecial() Applies FILTER_SANITIZE_SPECIAL_CHARS
stringFull() Applies FILTER_SANITIZE_FULL_SPECIAL_CHARS
date() Normalizes a date to Y-m-d
dateTime() Normalizes a date and time to Y-m-d H:i:s
base64() Strictly decodes Base64 input
json(bool $asArray) Decodes a JSON container
uuid(bool $asBytes = false) Validates a UUID and returns its canonical string or bytes
callback(callable $callback) Applies a callback and preserves its return type
noFilter() Returns the next value without filtering or coercion

Invalid validation input is converted to the selected filter's return type. For example, an invalid integer becomes 0, while an invalid email address becomes an empty string.

Array filtering

Use array() before an explicit filter to apply that filter to each array value. The optional level determines the permitted nesting depth.

Nested input can be handled by increasing the level:

Selecting array() for scalar input returns an empty array.

JSON

JSON filters accept containers only. Scalar JSON values such as true, 42, and null are rejected to the appropriate empty container.

UUIDs

Invalid UUID strings return '' in string mode and null in byte mode.

Callbacks

Callbacks may return any type. They can also be combined with array() to process every value in an input array.

Defaults and UTF-8 Handling

Enable filter-specific defaults for missing values:

UTF-8 conversion is enabled by default for filtered strings. It can be disabled when handling binary or otherwise encoding-sensitive values:

Security

Filtering and sanitization do not make input universally safe. Continue to use prepared statements for database queries, context-appropriate escaping for HTML and JavaScript output, and application-level validation and authorization.

Development

Run the complete local quality suite with:

The suite includes PHP syntax checks and PHPUnit tests. GitHub Actions runs it against every supported PHP version.

Releases

Releases use bare semantic-version tags such as 4.0.6. The local release tooling updates VERSION and the value below ### Version, and prevents tagging until a matching release section exists in CHANGELOG.md.

Pushing the tag runs the complete PHP quality matrix. After it passes, GitHub Actions creates the GitHub Release from that version's changelog section. Packagist continues to receive the tag through the repository's existing GitHub integration. Release tags must not be moved or reused.

Acknowledgements

This project was originally derived from Coercive/Globals and has since evolved as an independently maintained implementation.

License

GCWorld Globals is open-source software licensed under the terms in LICENSE.txt.


All versions of globals with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-json Version *
ext-mbstring Version *
ramsey/uuid Version ^4.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gcworld/globals contains the following files

Loading the files please wait ...