1. Go to this page and download the library: Download cupoftea/config-editor 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/ */
cupoftea / config-editor example snippets
/**
* Config Editor does not g representing the file contents.
*/
$config = file_get_contents('config/my_config.php');
$editor = new \CupOfTea\Config\Editor($config);
// Values can be set by passing a key and a value, or passing it an associative array with the values you want to set.
// Editor::set() returns the editor instance for easy chaining.
$editor->set('foo', 'bar')
->set(['baz' => 'qux', 'quux' => 'quuz']);
// Nested values can be set using array "dot" notation
$editor->set('paths.views', 'resources/views')
->set('paths.lang', 'resources/lang');
// Use the unset() method to completely remove a key from the configuration.
$editor->unset('foo')
->unset(['baz', 'quux']);
// Once you are done making edits, you can compile the config back to a string and write it to a file.
$newConfig = $editor->compile();
file_put_contents('config/my_edited_config.php', $newConfig);