PHP code example of filips123 / config-writer

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

    

filips123 / config-writer example snippets




use ConfigWriter\Config;




use ConfigWriter\Config;

n.php';
c/Config.php';
rs/PhpWriter.php';

$config = new Config;

$config = new Config;

$config = new Config(
    [
        'username' => 'user',
        'password' => 'pass',
    ],
    <<<EOD
/**
 * The configuration file.
 *
 * It contains configuration data.
 */
EOD;
);

$config->addRecord('application', 'ConfigWriter');

$config->addRecord('application', 'ConfigWriter', 'Application name');

$database = $config->addSection('database', [], 'Database settings');

$database->addRecord('host', 'localhost', 'Database host');
$database->addRecord('port', '3306', 'Database port');

$config->addSection(
    'database',
    [
        'host' => 'localhost',
        'port' => '3306',
    ],
    'Database settings');

$config->toString(new ConfigWriter\Writers\PhpWriter);
$config->toFile('config.php');

$config->toFile('config.php', new ConfigWriter\Writers\PhpWriter, ['indentation' => '	']);