tleckie / config
PHP config
Fund package maintenance!
teodoroleckie
www.paypal.com/donate?business=ZHYA2MTGA4884¤cy_code=USD
Requires
- php: ^8
Requires (Dev)
- friendsofphp/php-cs-fixer: v3.0.0-beta.2
- infection/infection: ^0.21.5
- phpunit/phpunit: ^9.5
README
Installation
You can install the package via composer:
composer require tleckie/config
Usage
<?php use Tleckie\Config\Config; $data = [ 'user' => [ 'name' => 'John', 'age' => 38, 'friend' => [ 'name' => 'Mario', 'age' => 25, 'friend' => [ 'name' => 'Pedro', 'age' => 48, ] ] ], 'size' => '800x900' ]; $config = new Config($data); var_dump($config->get('user')->get('friend')->get('friend')->get('name')); var_dump($config->user->friend->friend->name); $config->merge(['name' => 'Pedro']); $config->merge(new Config(['name' => 'Pedro']));