1. Go to this page and download the library: Download corex/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/ */
corex / config example snippets
$adapter = new ArrayAdapter([
'actor' => [
'name' => 'James Bond',
],
]);
$config = new Config([$adapter]);
$actorName = $config->getString('actor.name');
$adapter = new ArrayAdapter([
'actor' => [
'name' => 'James Bond',
],
]);
$config = new Config([$adapter]);
$actorName = $config->section('actor')->getString('name');
class MyConfigClass implements ConfigClassInterface
{
public function __construct(array $data)
{
}
public static function getSection(): string
{
return 'actor';
}
}
$adapter = new ArrayAdapter([
'actor' => [
'name' => 'James Bond',
],
]);
$config = new Config([$adapter]);
/** @var MyConfigClass $actorConfig */
$myConfigClass = $config->getConfigClassObject(MyConfigClass::class);
$config = (new ConfigFactory())
->createWithServerAndEnvAndProjectConfigArrayFileAdapter();