mhndev/config

一个轻量级的配置文件加载器,支持PHP、INI、XML、JSON和YAML文件,由hassankhan/config分支而来

1.0.0 2017-03-30 09:33 UTC

This package is auto-updated.

Last update: 2024-09-06 09:36:35 UTC


README

hassankhan/config分支而来,唯一的不同之处在于:通过文件名访问配置值

<?php
use Noodlehaus\Config;

// Load all supported files in a directory
$conf = new Config(__DIR__ . '/config');

考虑在提到的路径中,我们有多份配置文件,其中之一是mail.php,其内容如下

<?php
return [ 
       'driver'=>'file'
];

现在你可以这样访问这个变量

// Get value using key
$debug = $conf->get('mail.driver');