PHP Class Webiny\Component\Config\Config

Ex1: $config = \Webiny\Components\Config\Config::getInstance()->ini('path/to/file.ini'); Ex2: $config = $this->config()->ini('path/to/file.ini');
Inheritance: use trait Webiny\Component\StdLib\StdLibTrait, use trait Webiny\Component\StdLib\SingletonTrait
Show file Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
ini ( string $resource, boolean $flushCache = false, boolean $useSections = true, string $nestDelimiter = '.' ) : ConfigObject Get Config object from INI file or string
json ( string $resource, boolean $flushCache = false ) : ConfigObject Get Config object from JSON file or string
parseResource ( array | ArrayObject | AbstractDriver $resource, boolean $flushCache = false ) : ConfigObject Parse resource and create a Config object A valid resource is a PHP array, ArrayObject or an instance of AbstractDriver
php ( array $resource, boolean $flushCache = false ) : ConfigObject Get Config object from PHP array
yaml ( string $resource, boolean $flushCache = false ) : ConfigObject Get ConfigObject from YAML file or string

Method Details

ini() public method

Get Config object from INI file or string
public ini ( string $resource, boolean $flushCache = false, boolean $useSections = true, string $nestDelimiter = '.' ) : ConfigObject
$resource string Config resource in form of a file path or config string
$flushCache boolean Flush existing cache and load config file
$useSections boolean Default: true
$nestDelimiter string Delimiter for nested properties, ex: a.b.c or a-b-c
return ConfigObject

json() public method

Get Config object from JSON file or string
public json ( string $resource, boolean $flushCache = false ) : ConfigObject
$resource string Config resource in form of a file path or config string
$flushCache boolean Flush existing cache and load config file
return ConfigObject

parseResource() public method

Parse resource and create a Config object A valid resource is a PHP array, ArrayObject or an instance of AbstractDriver
public parseResource ( array | ArrayObject | AbstractDriver $resource, boolean $flushCache = false ) : ConfigObject
$resource array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject | Webiny\Component\Config\Drivers\AbstractDriver Config resource
$flushCache boolean Flush existing cache and load config file
return ConfigObject

php() public method

Get Config object from PHP array
public php ( array $resource, boolean $flushCache = false ) : ConfigObject
$resource array Config resource in form of a PHP array
$flushCache boolean Flush existing cache and create new config
return ConfigObject

yaml() public method

Get ConfigObject from YAML file or string
public yaml ( string $resource, boolean $flushCache = false ) : ConfigObject
$resource string Config resource in form of a file path or config string
$flushCache boolean Flush existing cache and load config file
return ConfigObject