dtkahl/php-simple-config 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dtkahl/php-simple-config

最新稳定版本:1.2.0

Composer 安装命令:

composer require dtkahl/php-simple-config

包简介

README 文档

README

Latest Stable Version License Build Status

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-12