PHPackages                             selective/config - 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. selective/config

ActiveLibrary

selective/config
================

Config component, strictly typed

1.4.0(2mo ago)19185.8k↑21.1%32MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Nov 13Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/selective-php/config)[ Packagist](https://packagist.org/packages/selective/config)[ Docs](https://github.com/selective-php/config)[ RSS](/packages/selective-config/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (10)Versions (9)Used By (2)

selective/config
================

[](#selectiveconfig)

A strictly typed configuration component for PHP. Inspired by [Apache Commons Configuration](https://commons.apache.org/proper/commons-configuration/).

[![Latest Version on Packagist](https://camo.githubusercontent.com/ef2544be6ccc564972592afb3cf52e0fd02c49653e6699673e79f2ab4fdc8d1e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73656c6563746976652d7068702f636f6e6669672e737667)](https://packagist.org/packages/selective/config)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![Build Status](https://github.com/selective-php/config/workflows/build/badge.svg)](https://github.com/selective-php/config/actions)[![Total Downloads](https://camo.githubusercontent.com/f7323020cf8f9ee5d8af139338847506f87e2ab794103bc1e3855a7a1963a39d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656c6563746976652f636f6e6669672e737667)](https://packagist.org/packages/selective/config/stats)

Requirements
------------

[](#requirements)

- PHP 8.2 - 8.5

Installation
------------

[](#installation)

```
composer require selective/config
```

Theory of Operation
-------------------

[](#theory-of-operation)

You can use the `Configuration` to read single values from a multidimensional array by passing the path to one of the `get{type}()` and `find{type}()` methods.

Each `get*() / find*()` method takes a default value as second argument. If the path cannot be found in the original array, the default is used as return value.

A `get*()` method returns only the declared return type. If the default value is not given and the element cannot be found, an exception is thrown.

A `find*()` method returns only the declared return type or `null`. No exception is thrown if the element cannot be found.

Usage
-----

[](#usage)

```
