netsilik/config

配置容器。

dev-master 2017-06-06 21:04 UTC

This package is auto-updated.

Last update: 2024-09-26 01:20:52 UTC


README

配置容器。

欧洲联盟公共许可,v. 1.1

除非适用法律要求或书面同意,否则在许可证下分发的软件按“现状”分发,不提供任何明示或暗示的保证或条件。

联系方式:info@netsilik.nl
最新版本可在以下位置获取:https://gitlab.com/Netsilik/Config

安装

composer require netsilik/config

用法

<?php
use Netsilik\Lib\Config;

// Set a directive
var_dump( Config::database('host', 'http://example.com') ); // returns: Void

// Get a directive
var_dump( Config::database('host') ); // returns: http://example.com

// Attempting to get an undefined directive triggers an E_USER_WARNING
var_dump( Config::database('undefined') ); // Triggers E_USER_WARNING:  Configuration directive database.undefined undefined in __FILE__ on line __LINE__

// Attempting to set a directive that has been set before, triggers a (fatal) E_USER_ERROR
var_dump( Config::database('host', 'http://example.com') ); // Triggers E_USER_ERROR: Configuration directive database.host already defined in __FILE__ on line __LINE__