2017 © Pedro Peláez
 

cakephp-plugin yaml-config

Yaml Configuration support for CakePHP 3

image

guemidiborhane/yaml-config

Yaml Configuration support for CakePHP 3

  • Saturday, March 12, 2016
  • by guemidiborhane
  • Repository
  • 2 Watchers
  • 9 Stars
  • 25 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 3 Versions
  • 9 % Grown

The README.md

Yaml for CakePHP 3

implements most of the YAML 1.2 specification using Symfony Yaml Component to CakePHP 3 for parsing config files, (*1)

Requirements

The 3.0 branch has the following requirements:, (*2)

  • 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, (*3)

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

And run php composer.phar update, (*4)

then add this lines to your config/bootstrap.php, (*5)

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, (*6)

Usage

if you want to use the plugin Shell to convert your current config add the lines to config/bootstrap.php, (*7)

Plugin::load('Yaml');

then in your Console or Terminal type :, (*8)

bin/cake convert

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

bin/cake convert your_file_name

the file will be create in your config/ directory., (*10)

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: contact@localhost.dz
      cherset: utf-8
      headerCharset: utf-8   

The Versions

12/03 2016

dev-master

9999999-dev

Yaml Configuration support for CakePHP 3

  Sources   Download

The Requires

 

by Borhane Eddine Guemidi

config cakephp yaml

31/07 2015

1.1

1.1.0.0

Yaml Configuration support for CakePHP 3

  Sources   Download

The Requires

 

by Chobo Islah

config cakephp yaml

24/01 2015

1.0

1.0.0.0

Yaml Configuration support for CakePHP 3

  Sources   Download

The Requires

 

by Chobo Islah

config cakephp yaml