PHP code example of comphp / config-xml

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

    

comphp / config-xml example snippets




use CommonPHP\Drivers\Config\XML\XmlConfigurationDriver;

$driver = new XmlConfigurationDriver();

$config = [
    'app' => 'demo',
    'debug' => true,
    'database' => [
        'host' => 'localhost',
    ],
];

$xml = $driver->encode($config);
$decoded = $driver->decode($xml);

$driver->write(__DIR__ . '/config.xml', $config);
$fromFile = $driver->read(__DIR__ . '/config.xml');