wilkques/config

v3.0.2 2024-06-11 06:08 UTC

This package is auto-updated.

Last update: 2024-11-11 07:00:10 UTC


README

TESTS Latest Stable Version License

composer require wilkques/config

How to use

  1. Add PHP config file (path default ./Config)

    <?php
    
    return [
        'abc' => 'efg',
    ];

    Or json

    {
        "abc": "efg",
    }

    Or yaml
    ※need php yaml extension

    abc:
        efg: "hij"
  2. 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