wilkques / config
v3.0.2
2024-06-11 06:08 UTC
Requires
- php: >=8.0
- wilkques/php-helper: *
Requires (Dev)
Suggests
- ext-yaml: Required to use the YAML output option
README
composer require wilkques/config
How to use
-
Add PHP config file (path default
./Config
)<?php return [ 'abc' => 'efg', ];
Or json
{ "abc": "efg", }
Or yaml
※need php yaml extensionabc: efg: "hij"
-
Add PHP code in file
require_once 'vendor/autoload.php'; config() //->setPath('<config/path>') custom config path ->build(); $config = config('<key>'); // get config item $config->setItem('<key>', '<value>'); // set config item $config->withConfig([ '<key>' => '<value>' // set config with array ]); $config->getItem('<key>'); // get config item $config->all(); // get config all items