devitek/yaml-configuration

Add YAML file support to Laravel Configuration

Installs: 1 786

Dependents: 0

Stars: 4

Watchers: 2

Forks: 3

Open Issues: 1

Language: PHP

2.0.1 2015-08-09 03:01 UTC

README

This package uses Symfony/Yaml parser.

Installing

Add "devitek/yaml-configuration": "2.*" to your composer.json by running :

php composer.phar require devitek/yaml-configuration

And select version : 2.*

Add support in Laravel

You have to add (or merge)

protected function bootstrappers()
{
    return array_merge($this->bootstrappers, [\\Devitek\\Core\\Config\\LoadYamlConfiguration::class]);
}

to your app/Http/Kernel.php and/or app/Console/Kernel.php.

How to use

Just use regular php files or use yml or yaml files instead.

PHP :

<?php

return [
    'debug' => false,
    'key' => 'foobar',
];

Will be equivalent to :

YAML

debug: false
key: foobar

Paths Helpers

You can use paths helpers provided by Laravel like that :

routes_file: %app_path%/routes.php
unit_test: %base_path%/behat.yml
main_style: %public_path%/css/style.css
manifest: %storage_path%/meta
  • %app_path% refers to app_path()
  • %base_path% refers to base_path()
  • %public_path% refers to public_path()
  • %storage_path% refers to storage_path()

Enjoy it ! Feel free to fork :) !