1. Go to this page and download the library: Download initphp/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/ */
initphp / config example snippets
composer
class MyAppConfig extends \InitPHP\Config\Classes
{
public $url = 'http://lvh.me';
public $name = 'LocalHost';
public $db = [
'host' => 'localhost',
'user' => 'root'
];
// ...
}
public function setClass(string|object $classOrObject): self;
namespace App\Config;
class AppConfig
{
public $url = 'http://lvh.me';
}
class Database
{
public $host = 'localhost';
}
use \InitPHP\Config\Config;
// Class
Config::setClass(\App\Config\AppConfig::class);
// or Object
Config::setClass(new \App\Config\Database());
Config::get('appconfig.url');
Config::get('database.host');
public function setArray(?string $name, array $assoc = []): self;