1. Go to this page and download the library: Download effectra/config 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/ */
effectra / config example snippets
use Effectra\Config\ConfigFile;
use Effectra\Config\ConfigDriver;
use Effectra\Config\ConfigCookie;
use Effectra\Config\ConfigEditor;
use Effectra\Config\ConfigFile;
// Create a ConfigFile instance with the path to your configuration file
$configFile = new ConfigFile('/path/to/config.ini');
// Read the configuration settings from the file
$config = $configFile->read();
// Access specific sections and settings
$databaseConfig = $configFile->getSection('database');
$host = $databaseConfig['host'];
$username = $databaseConfig['username'];
// Modify a setting and write the changes back to the file
$config['app']['debug'] = true;
$configFile->setFile('/path/to/config.ini')->write($config);
use Effectra\Config\ConfigDriver;
// Create a ConfigDriver instance with initial settings
$driver = new ConfigDriver('mysql', 'localhost', 3306, 'username', 'password');
// Get the current driver details
$driverName = $driver->getDriver();
$host = $driver->getHost();
// Update the driver settings
$driver = $driver->withHost('newhost')->withPort(8888);
// Get the updated driver details
$newHost = $driver->getHost();
$newPort = $driver->getPort();
use Effectra\Config\ConfigCookie;
// Create a ConfigCookie instance with initial attributes
$cookie = new ConfigCookie('session', 'abc123', 3600, '/', 'example.com', true, true);
// Get the cookie attributes
$name = $cookie->getName();
$secure = $cookie->getSecure();
// Create a new cookie instance with updated attributes
$newCookie = $cookie->withExpireOrOptions(7200)->withSecure(false);
// Get the updated cookie attributes
$newExpire = $newCookie->getExpireOrOptions();
$newSecure = $newCookie->getSecure();
use Effectra\Config\ConfigEditor;
// Create a ConfigEditor instance with the path to an EditorConfig file
$editorConfig = new ConfigEditor('/path/to/.editorconfig');
// Get the root value from the EditorConfig file
$root = $editorConfig->getRoot();
// Get the indent_size and end_of_line settings
$indentSize = $editorConfig->getIndentSize();
$endOfLine = $editorConfig->getEndOfLine();
// Check if a charset setting is defined
if ($editorConfig->hasSection('charset')) {
$charsetSettings = $editorConfig->getSection('charset');
// Process the charset settings
} else {
// Handle the case when charset settings are not present
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.