阿里云/yaml-配置

为Laravel配置添加YAML文件支持

3.1.1 2016-08-20 20:09 UTC

This package is not auto-updated.

Last update: 2024-09-21 06:24:22 UTC


README

此包使用Symfony/Yaml解析器。

安装

通过运行以下命令将"vunh00/yaml-configuration": "3.1.*"添加到您的composer.json文件中:

php composer.phar require vunh00/yaml-configuration

并选择版本:3.1.*

在Laravel中添加支持

您必须将以下内容添加到您的app/Http/Kernel.php和/或app/Console/Kernel.php中(或合并):

protected function bootstrappers()
{
    $this->bootstrappers[] = 'Vunh00\Core\Config\LoadYamlConfiguration';
    return $this->bootstrappers;
}

使用方法

只需使用常规php文件,或者使用ymlyaml文件代替。

PHP :

<?php

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

将等同于

YAML

debug: false
key: foobar

使用函数

您可以使用任何PHP函数,如下所示:

routes_file: %app_path%/routes.php
unit_test: %base_path:behat.yml%
something: %sprintf:hell %s,world%

享受它!随时分支 :) !

此包是devitek/yaml-configuration的分支。