thiphariel/config-file-loader

PHP配置文件加载器

1.2.0 2018-05-18 15:43 UTC

This package is not auto-updated.

Last update: 2024-09-29 04:07:29 UTC


README

Build Status Coverage Status Downloads GitHub license

SensioLabsInsight

这个库是一个PHP配置文件加载器,目前支持JSON和PHP文件。

要求

  • PHP >=7.1

安装

composer require thiphariel/config-file-loader

用法

// Create an instance of Config
$config = new Config();

// Load JSON configuration file
$config->load("config.json");

// Load PHP configuration file
$config->load("config.php");

// Getting values
$host = $config->get("host");
$port = $config->get("port");

// Nested keys
$env = $config->get("environment.dev");

配置示例可以在tests/config文件夹中找到。