janisto/env

Environment class, used to set configuration depending on the server environment.

1.0.1 2016-05-25 14:27 UTC

This package is not auto-updated.

Last update: 2024-11-09 19:51:07 UTC


README

Environment class, used to set configuration depending on the server environment.

Software License Build Status Code Quality Code Coverage Packagist Version Total Downloads

Installation

If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this package using the following command:

php composer.phar require "janisto/env" "*"

or add

"janisto/env": "*"

to the require section of your application's composer.json file.

Usage

web index.php

<?php
require(dirname(__DIR__) . '/vendor/autoload.php');

$env = new \janisto\env\Environment(dirname(__DIR__) . '/config');
// $env->config // environment configuration array

or if you have multiple configuration locations

<?php
require(dirname(__DIR__) . '/vendor/autoload.php');

$env = new \janisto\env\Environment([
    dirname(__DIR__) . '/common/config',
    dirname(__DIR__) . '/backend/config'
]);
// $env->config // environment configuration array

console cli.php

#!/usr/bin/env php
<?php

require(__DIR__ . '/vendor/autoload.php');

$env = new \janisto\env\Environment(__DIR__ . '/config');
// $env->config // environment configuration array

Use cli.php

export APP_ENV='dev' && ./cli.php

Documentation

See examples/.

Contributing

Please see CONTRIBUTING for details.

Credits

License

Public domain. Please see License File for more information.