1. Go to this page and download the library: Download samsonos/php_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/ */
samsonos / php_config example snippets
namespace project;
class entityIDConfig extends samsonos\config\Entity
{
}
namespace project\production;
class entityIDConfig extends samsonos\config\Entity
{
public $parameter = 'value';
}
namespace project;
class entityIDConfig extends samsonos\config\Entity
{
public $stringParameter = 'I am a string';
public $integerParameter = 1123;
public $arrayParameter = array('1', 123);
}
namespace project;
class entityIDConfig extends samsonos\config\Entity
{
public $stringParameter = 'I am a string';
public $integerParameter = 1123;
public $arrayParameter = array('1', 123);
public $complicatedParameter;
public function __construct()
{
// Fill your parameter with what you want
$this->complicatedParameter = $this->stringParameter . dirname(__DIR__);
}
}
// Mention - class name is the same, only namespace is different
namespace project\other;
// We are extending global configuration from previous example
class entityIDConfig extends project\entityIDConfig
{
// We overload only this parameter, as we want all to be the same as parent
public $integerParameter = 2222;
}
$manager = new \samsonos\config\Manager('.../path/to/base/folder');
$manager->init();
$manager = new \samsonos\config\Manager();
$manager->init('.../path/to/base/folder');
$manager = new \samsonos\config\Manager();
$manager->init('.../path/to/base/folder');
$manager->init('.../path/to/OTHER/folder');
__construct
__construct
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.