PHPackages                             proteins/options - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. proteins/options

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

proteins/options
================

A dictionary to handle application-wide options

1.0.5(6y ago)1472MITPHPPHP ^7.2

Since May 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/php-protein/options)[ Packagist](https://packagist.org/packages/proteins/options)[ RSS](/packages/proteins-options/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (6)Used By (2)

[![](https://raw.githubusercontent.com/php-protein/docs/master/assets/protein-large.png)](https://raw.githubusercontent.com/php-protein/docs/master/assets/protein-large.png)

Protein | Options
=================

[](#protein--options)

A dictionary to handle application-wide options
-----------------------------------------------

[](#a-dictionary-to-handle-application-wide-options)

### Install

[](#install)

---

```
composer require proteins/options

```

Require the global class via :

```
use Proteins\Option;
```

or the include the trait in your classes via :

```
use Proteins\Options;

class MyClass {
    use Options;
}
```

### Loading a config file

[](#loading-a-config-file)

You can load a config tree from a file or an array via the utility loaders methods :

MethodDescription`loadArray`Load directly an array of key-&gt;values`loadPHP`Load array key-&gt;values from a PHP file returning it.`loadINI`Load values from an `.ini` file.`loadJSON`Load JSON key-&gt;value map.`loadENV`Load environment variables from a .env file.#### Loading options from file or array

[](#loading-options-from-file-or-array)

```
Option::loadPHP('config.php');
```

**config.php**

```
