PHP code example of achrome / conphig

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

    

achrome / conphig example snippets


use Conphig\Factories\ConfigurationFactory;

$configCreator = new ConfigurationFactory;
$configuration = $configCreator->setConfigPath('/path/to/config/dir')
					       ->setConfigFileName('configFileName')
					       ->setConfigType('filetype')
					       ->create();


use Conphig\Factories\ConfigurationFactory;

$configCreator = new ConfigurationFactory;
$configuration = $configCreator->create('/path/to/config/file.ext');


use Conphig\Factories\ConfigurationFactory;

$configCreator = new ConfigurationFactory('/path/to/config/dir');
$configuration = $configCreator->create();

use Conphig\Factories\ConfigurationFactory;

$configCreator = new ConfigurationFactory('/path/to/config/dir');
$configuration = $configCreator->create();

echo $configuration->database->engine; //Will output mysql

namespace Foo;

use Conphig\Configurators\AbstractConfigurator;

class BarConfigurator extends AbstractConfigurator {

	public function parseConfig() {
		//The file name is saved in AbstractConfigurator::filePath and can be used here to write your own logic to parse the file.
		//Save the configuration in AbstractConfigurator::configuration for the factory to be able to return it.
	}
}

use Conphig\Factories\ConfigurationFactory;

$configCreator = new ConfigurationFactory('/path/to/custom/config/dir');
$configuration = $configCreator->registerConfigHandler('custom', 'Foo\\BarConfigurator')->create();
shell
$ php composer.phar