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 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' ] ];
string
File extension.
string
The path this engine finds files on.
Constructor for PHP Config file reading.
Get file path
Converts the provided $data into a string of PHP code that can be used saved into a file and loaded later.
Read a config file and return its contents.
__construct(string|null $path = null)
Constructor for PHP Config file reading.
string|null
$path optional The path to read config files from. Defaults to CONFIG.
_getFilePath(string $key, bool $checkExists = false): string
Get file path
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.
string
Cake\Core\Exception\CakeException
dump(string $key, array $data): bool
Converts the provided $data into a string of PHP code that can be used saved into a file and loaded later.
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.
bool
read(string $key): array
Read 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().
string
$key The identifier to read from. If the key has a . it will be treated as a plugin prefix.
array
Cake\Core\Exception\CakeException
File extension.
string
The path this engine finds files on.
string
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Core.Configure.Engine.PhpConfig.html