bosnadev/yaml

本包最新版本(1.1)无可用许可证信息。

为Laravel 4配置添加Yaml文件支持的包

1.1 2014-11-08 19:34 UTC

This package is auto-updated.

Last update: 2024-09-11 20:42:14 UTC


README

此包基于 devitek/yaml-configuration 包。它使用Symfony/Yaml解析器。Yaml配置包是Larapress CMS的一部分。

安装

从您的终端运行以下命令

composer require "bosnadev/yaml: 1.*"

或者在您的composer.json文件的要求部分添加此内容

"bosnadev/yaml": "1.*"

然后运行 composer update

更新composer后,将 YamlServiceProvider 添加到app/config/app.php文件中的providers数组中

'providers' => [
  // other providers
  ...
  
  'Bosnadev\Yaml\YamlServiceProvider'
];

这样就完成了!您现在可以将.yaml配置文件添加到 app/config 或您的包配置文件夹中。您仍然可以使用常规php文件进行配置。

PHP

<?php
return [
  'enable_registration' => true,
  'themes_dir'          => %public_path%/themes
];

将等同于

---
enable_registration: true
themes_dir: %public_path%/themes

路径助手

您可以使用Laravel提供的路径助手,例如

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% 表示 app_path()
  • %base_path% 表示 base_path()
  • %public_path% 表示 public_path()
  • %storage_path% 表示 storage_path()

许可证

本包是开源软件,根据MIT许可证授权。