Skip to content

Latest commit

 

History

History
121 lines (90 loc) · 2.35 KB

README.md

File metadata and controls

121 lines (90 loc) · 2.35 KB

Yaml for CakePHP 3

implements most of the YAML 1.2 specification using Symfony Yaml Component to CakePHP 3 for parsing config files

Requirements

The 3.0 branch has the following requirements:

  • CakePHP 3.0.0 or greater.

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

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

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: 
    <<: *default_configuration
    database: my_database
  # PHPUnit tests datasource
  test:
    <<: *default_configuration
    database: my_database_test



# Email Configuration
EmailTransport:
  default:
      className: Mail
      host: localhost
      port: 1025
      timeout: 30
      # username: user
      # password: secret
      client: null
      tls: null
Email:
  default:
      transport: default
      from: [email protected]
      cherset: utf-8
      headerCharset: utf-8