Skip to content

Getting Started

Ferret is a configuration management library for PHP that supports multiple formats including PHP arrays, JSON, YAML, TOML, INI, XML, and NEON.

Terminal window
composer require cline/ferret
use Cline\Ferret\Config;
// Load a configuration file
$config = Config::load('config.json');
// Access values
$value = $config->get('database.host');
// Set values
$config->set('database.port', 3306);
// Save changes
$config->save('config.json');

Ferret automatically detects the format based on file extension:

ExtensionFormat
.phpPHP array
.jsonJSON
.yaml, .ymlYAML
.tomlTOML
.iniINI
.xmlXML
.neonNEON