Download the PHP package setherator/variables without Composer

On this page you can find all versions of the php package setherator/variables. 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 variables

Variables

Latest Version on Packagist Build Status Code Quality Code Coverage Mutation testing badge Total Downloads

The Setherator Variable management library. Manages and processes variable values with some additional magic.

Install

Via Composer

Usage

A compilation of several use cases of Variables and it's helpers.

Will result in:

Helpers

A variable value can be any scalar, array, object type but also closure which will be executed and cached. To prevent caching value should implement NonCacheableClosure interface for e.g. factory helper function.

Reference

A function to fetch variable value from Variables instance. If not found $default = null will be returned. If raw value before evaluation required use $raw = true.

To fetch value at variable get time use these functions.

Enviroment variable

A function to fetch environment variable. If not found $default = null will be returned.

Context

A function to wrap your closure and inject context from Variables::getContext();

Will return your closure wrapped with context variables + extra $args as arguments. $args will be evaluated using Variables::parseValue() function. It will behave as normal Variable value.

Attention: Context returned closure does not accept any arguments.

Factory

A function to prevent your closue value from getting cached. Your closure will be called everytime value is accessed. $args will be passed as arguments to closure function. $args will be evaluated using Variables::parseValue() function. It will behave as normal Variable value.

Will return a value which implements NonCacheableClosure interface and prevents it from caching and behave as your normal closure.

All

A function to evaluate all values passed to arguments and return result as array.

Will return an array of all $args evaluated.

Tip: To evaluate all values at variable get time use function: allFn(/* ... */).

Logic

A function to evaluate condition and decide which value to use. $condtion, $true, $false are evaluated using Variables::parseValue() function.

Will return a closure which will decide which $true or $false to return based on $condition

Attention: Logic returned closure does not accept any arguments.

Passthrough

A function which will pass all evaluted values as argumnents to closure.

Will return a closure which will pass $args evaluated as arguments to Closure.

Attention: Passthrough returned closure does not accept any arguments.

First

A function which return a first truthfull value from arguments. $args will be evaluated using Variables::parseValue() function.

Tip: To evaluate at variable get time use function: firstFn(/* ... */).

Value Parsers

You can implement your own value parsers to be parsed when accessing variables value.

Testing

Run test cases

Run test cases with coverage (HTML format)

Run PHP style checker

Run PHP style fixer

Run all continuous integration tests

Contributing

Please see CONDUCT for details.

License

Please see License File for more information.


All versions of variables with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4||^8.0
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 setherator/variables contains the following files

Loading the files please wait ....