1. Go to this page and download the library: Download kayzorelabs/phpconfigparser 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/ */
namespace Your\Namespace;
use KayzoreLabs\ToolKit\ConfigParser\ConfigParser;
$cfg = new ConfigParser();
// load file
$cfg->read('/home/user/.config/server.cfg.sample');
// modify a value (section, option, value)
$cfg->set('github.com', 'user', 'bar');
// and save it
$cfg->save();
// ... or, write to another file
$cfg->write('/home/user/.config/server.cfg');
namespace Your\Namespace;
use KayzoreLabs\ToolKit\ConfigParser;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
class MyConfigParser extends ConfigParser
{
protected $logger;
public function __construct(array $defaults = array(), array $settings = array())
{
parent::__construct($defaults, $settings);
// create a log channel
$this->logger = new Logger('ConfigParser');
$this->logger->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
}
public function log($message)
{
// add records to the log
$this->logger->addError($message);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.