dtkahl/php-simple-config
最新稳定版本:1.2.0
Composer 安装命令:
composer require dtkahl/php-simple-config
包简介
README 文档
README
PHP simple config
This is a simple config handler class with dot-syntax for PHP.
Dependencies
PHP >= 5.6.0
Installation
Install with Composer:
composer require dtkahl/php-simple-config
Usage
Refer namespace:
use Dtkahl\SimpleConfig\Config;
Create new Config instance:
$config = new Config([ "database" => [ "host" => "localhost", "port" => 1337, "username" => "developer",> 1337, 38 "usernam "password" => "secret", ], "debug" => true, // ... );
you can also load Config from file:
$config = new Config(require("./config.php"));
Example config.php:
<?php return [ "database" => [ "host" => "localhost", "port" => 1337, "username" => "developer", "password" => "secret", ], "debug" => true, // ... ]
Methods
has($path)
Determine if config entry exists on given path.
get($path, $default = null)
Returns config entry exists on given path or returns $default if path does not exist in config.
set($path, $value, $force = false)
Set config entry on given path (override if existing). Set parameter $force if given path dosn't exist.
Returns config instance.
remove($path)
Remove config entry on given path if existing. Returns config instance.
setAlias($alias, $path)
Add an alias for a given path. Alias should not contain a dot for obvious reason.
统计信息
- 总下载量: 9.47k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-12