PHP code example of ulrack / configuration

1. Go to this page and download the library: Download ulrack/configuration library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ulrack / configuration example snippets




use Ulrack\Configuration\Component\Configuration\PackageLocator;

PackageLocator::registerLocation(__DIR__);




use Ulrack\Configuration\Dao\Locator;
use Ulrack\Codec\Component\JsonCodec;
use Ulrack\Validator\Component\Logical\AlwaysValidator;


new Locator(
    'database', // The key that the configuration is associated with.
    'configuration/database', // The sub-directory which is crawled by the compiler to fetch the configuration.
    new JsonCodec(512, 0, 0, true), // Or any other class implementing the DecoderInterface from the ulrack/codec package.
    new AlwaysValidator(true) // Or any other class implementing the ValidatorInterface from the ulrack/validator package.
);
json
{
    "autoload": {
        "files": ["locator.php"]
    }
}