qlimix/environment

Environment utilities

2.0.1 2020-11-14 12:13 UTC

This package is auto-updated.

Last update: 2024-10-14 20:42:20 UTC


README

Travis CI Coveralls Packagist MIT License

Environment utilities. Loading env values through type loader.

Install

Using Composer:

$ composer require qlimix/environment

usage

Environment object

Create at bootstrapping based on for example an env value

<?php

use Qlimix\Environment\Environment;

$env = Environment::createDevelopment();

Environment object

Create at bootstrapping based on for example an env value

<?php

use Qlimix\Environment\Value\Loader;

$env = new Loader();
$string = $env->getString('value');
$integer = $env->getInt('value');
$float = $env->getFloat('value');
$bool = $env->getBoolean('value');
$array = $env->getArray('value', ',');
$mapped = $env->getMapped('value', function (string $value) {
    return base64_decode($value);
});

Testing

To run all unit tests locally with PHPUnit:

$ vendor/bin/phpunit

Quality

To ensure code quality run grumphp which will run all tools:

$ vendor/bin/grumphp run

Contributing

Please see CONTRIBUTING for details.