Class PhpConfig
PHP engine allows Configure to load configuration values from files containing simple PHP arrays.
Files compatible with PhpConfig should return an array that contains all of the configuration data contained in the file.
An example configuration file would look like::
<?php
return [
    'debug' => false,
    'Security' => [
        'salt' => 'its-secret'
    ],
    'App' => [
        'namespace' => 'App'
    ]
];See: \Cake\Core\Configure::load() for how to load custom configuration files.
Property Summary
- 
        $_extension protectedstringFile extension. 
- 
        $_path protectedstringThe path this engine finds files on. 
Method Summary
- 
          __construct() publicConstructor for PHP Config file reading. 
- 
          _getFilePath() protectedGet file path 
- 
          dump() publicConverts the provided $data into a string of PHP code that can be used saved into a file and loaded later. 
- 
          read() publicRead a config file and return its contents. 
Method Detail
__construct() ¶ public
__construct(string|null $path = null)Constructor for PHP Config file reading.
Parameters
- 
                string|null$path optional
- The path to read config files from. Defaults to CONFIG. 
_getFilePath() ¶ protected
_getFilePath(string $key, bool $checkExists = false): stringGet file path
Parameters
- 
                string$key
- The identifier to write to. If the key has a . it will be treated as a plugin prefix. 
- 
                bool$checkExists optional
- Whether to check if file exists. Defaults to false. 
Returns
stringFull file path
Throws
Cake\Core\Exception\ExceptionWhen files don't exist or when files contain '..' as this could lead to abusive reads.
dump() ¶ public
dump(string $key, array $data): boolConverts the provided $data into a string of PHP code that can be used saved into a file and loaded later.
Parameters
- 
                string$key
- The identifier to write to. If the key has a . it will be treated as a plugin prefix. 
- 
                array$data
- Data to dump. 
Returns
boolSuccess
read() ¶ public
read(string $key): arrayRead a config file and return its contents.
Files with . in the name will be treated as values in plugins. Instead of
reading from the initialized path, plugin keys will be located using Plugin::path().
Setting a $config variable is deprecated. Use return instead.
Parameters
- 
                string$key
- The identifier to read from. If the key has a . it will be treated as a plugin prefix. 
Returns
arrayParsed configuration values.
Throws
Cake\Core\Exception\Exceptionwhen files don't exist or they don't contain `$config`. Or when files contain '..' as this could lead to abusive reads.
