PHP code example of senhung / config-read-write

1. Go to this page and download the library: Download senhung/config-read-write 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/ */

    

senhung / config-read-write example snippets


Configruation::initializeConfigs(
    [string $configFilePath [, bool $absolutePath [, string $separator]]]
): void



enhung\Config\Configuration;

/* Initialize config array in Configuration class */
Configuration::initializeConfigs('config_file_path', true, 'separator');


Configuration::read('<config-you-want-to-read>');

Configuration::set('<config-you-want-to-write>', '<change-to>');



enhung\Config\Configuration;

/* Read config APP_NAME */
echo Configuration::read('APP_NAME') . "\n";

/* Read config VERSION */
echo Configuration::read('VERSION') . "\n";

/* Set APP_NAME to config-write */
Configuration::set('APP_NAME', 'config-write');

/* Read APP_NAME again to see the changes */
echo Configuration::read('APP_NAME') . "\n";