PHPackages                             guemidiborhane/yaml-config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. guemidiborhane/yaml-config

ActiveCakephp-plugin[Parsing &amp; Serialization](/categories/parsing)

guemidiborhane/yaml-config
==========================

Yaml Configuration support for CakePHP 3

1.1(10y ago)113464PHP

Since Jan 24Pushed 6y ago3 watchersCompare

[ Source](https://github.com/guemidiborhane/yaml-config)[ Packagist](https://packagist.org/packages/guemidiborhane/yaml-config)[ RSS](/packages/guemidiborhane-yaml-config/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

Yaml for **CakePHP 3**
======================

[](#yaml-for-cakephp-3)

implements most of the YAML 1.2 specification using [Symfony Yaml Component](https://github.com/symfony/Yaml) to CakePHP 3 for parsing config files

Requirements
------------

[](#requirements)

The 3.0 branch has the following requirements:

- CakePHP 3.0.0 or greater.

Installation
------------

[](#installation)

- Install the plugin with composer from your CakePHP Project's ROOT directory (where composer.json file is located)

```
php composer.phar require chobo1210/yaml "dev-master"
```

OR add this lines to your `composer.json`

```
"require": {
  "chobo1210/Yaml": "dev-master"
}
```

And run `php composer.phar update`

then add this lines to your `config/bootstrap.php`

```
use Yaml\Configure\Engine\YamlConfig;

try {
  Configure::config('yaml', new YamlConfig());
  Configure::load('your_file', 'yaml');
} catch (\Exception $e) {
  die('Unable to load config/your_file.yml.');
}
```

your file must be in the `config/` directory **replace** `your_file` with the name of your *YAML* file **without the extension**

Usage
-----

[](#usage)

if you want to use the plugin Shell to convert your current config add the lines to `config/bootstrap.php`

```
Plugin::load('Yaml');
```

then in your Console or Terminal type :

```
bin/cake convert
```

Optionally you can set the name of your **YAML** file ( without the extension ) default is : `app.yml`

```
bin/cake convert your_file_name
```

the file will be create in your `config/` directory.

Example
-------

[](#example)

```
debug: true

Asset:
  timestamp: true

# Default Database Connection informations
default_configuration: &default_configuration
  className: Cake\Database\Connection
  driver: Cake\Database\Driver\Mysql
  persistent: false
  host: localhost
  login: root
  password: secret
  prefix: false
  encoding: utf8
  timezone: +01:00
  cacheMetadata: true
  quoteIdentifiers: false

# Datasources
Datasources:
  # Default datasource
  default:
