PHP code example of carry0987 / config

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

    

carry0987 / config example snippets


use carry0987\Config\Config;
use carry0987\Redis\RedisTool;

// Assuming $pdo is an instance of PDO
$config = new Config($pdo);

// Optionally, you can set a custom table name for the configuration.
$config->setTableName('your_custom_config_table');

// Assuming $redis is an instance of RedisTool
$config->setRedis($redis);

// To add a new configuration setting:
$result = $config->addConfig('site_name', 'My Awesome Website');

// To fetch a configuration value by its key:
$siteName = $config->getConfig('site_name', true);

// To update an existing configuration setting:
$result = $config->updateConfig('site_name', 'My Even More Awesome Website');