PHPackages                             aweitian/config - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. aweitian/config

ActiveProject[Utility &amp; Helpers](/categories/utility)

aweitian/config
===============

简单.NET文件导入到数组

v2.1.1(8y ago)01792MITPHPPHP &gt;=5.3.0

Since May 15Pushed 8y ago1 watchersCompare

[ Source](https://github.com/aweitian/config)[ Packagist](https://packagist.org/packages/aweitian/config)[ Docs](https://github.com/aweitian/config)[ RSS](/packages/aweitian-config/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (2)

配置
==

[](#配置)

Config组件用于完成网站配置项管理。

\##开始使用

\####安装组件 使用 composer 命令进行安装或下载源代码使用。

```
composer require aweitian/config

```

\####加载.env文件 参数为.env文件所在目录

```
Config::loadEnv(dirname(__DIR__));

```

一个简单的env内容如下:

```
DB_DRIVER=mysq22l
DB_HOST=127.0.0.1
DB_DATABASE=hdphp
DB_USER=root
DB_PASSWORD=

```

\####读取env文件内容

```
tian\Config::env('DB_HOST','localhost');

```

读取.env文件中的 DB\_HOST配置，如果为空时使用 localhost

\####设置配置

```
tian\Config::set('alipay.key.auth','aweitian');

```

\####加载所有文件

```
//加载config目录下的所有文件到配置容器中
tian\Config::loadFiles('config');

```

\####设置多个配置

```
tian\Config::batch(['app.debug'=>true,'database.host'=>'localhost']);

```

\####检测配置

```
tian\Config::has('web.master');

```

\####获取配置 如果想要获取配置文件的所有内容，只传递文件名就可以：

```
tian\Config::get('app');

```

\####获取子元素 获取配置文件使用 get 方法完成，参数为 ”配置文件名.配置项"的形式。

```
tian\Config::get('view.path');

```

\####获取所有 也可以使用 all 方法获取所有配置，例如：

```
tian\Config::all();

```

\####排除批定字段

```
tian\Config::getExName('database',['write','read']);

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~103 days

Total

4

Last Release

2975d ago

Major Versions

v1.0 → v2.0.02018-01-24

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=5.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f29043b8f5aebb2d7a34302c1bc1626bd711398bb0c5387cd8630b45057a4c9?d=identicon)[awei.tian](/maintainers/awei.tian)

---

Top Contributors

[![aweitian](https://avatars.githubusercontent.com/u/6269615?v=4)](https://github.com/aweitian "aweitian (10 commits)")

---

Tags

configaweitian

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/aweitian-config/health.svg)

```
[![Health](https://phpackages.com/badges/aweitian-config/health.svg)](https://phpackages.com/packages/aweitian-config)
```

###  Alternatives

[symfony/options-resolver

Provides an improved replacement for the array\_replace PHP function

3.2k493.9M1.6k](/packages/symfony-options-resolver)[league/config

Define configuration arrays with strict schemas and access values with dot notation

564302.2M24](/packages/league-config)[dflydev/dot-access-configuration

Given a deep data structure representing a configuration, access configuration by dot notation.

13414.5M4](/packages/dflydev-dot-access-configuration)[akaunting/laravel-setting

Persistent settings package for Laravel

495805.1k7](/packages/akaunting-laravel-setting)[m1/env

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

6412.0M21](/packages/m1-env)[jbzoo/data

An extended version of the ArrayObject object for working with system settings or just for working with data arrays

891.6M23](/packages/jbzoo-data)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
