PHPackages                             lbzy/host-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. lbzy/host-config

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

lbzy/host-config
================

1.0.1(7y ago)021Apache-2.0PHPPHP &gt;=7.0.0

Since Feb 13Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

\######如何使用

> composer require lbzy/host-config

```
try {
	// 配置根域名key
	define('ENV_TEST', 'test');
	define('ENV_ONLINE', 'online');
	// 配置根域名
	define('ROOT_HOST_LIST', [
		ENV_ONLINE 	=> ['test1.com', 'test2.com'],
		ENV_TEST 	=> 'localhost',
	]);
	// 解析
	$hostInstance 	= \Lbzy\HostConfig\Host::instance(ROOT_HOST_LIST);
	// define('HOST', $hostInstance->getHost());
	// define('ROOT_HOST', $hostInstance->getRootHost());
	// define('ROOT_HOST_KEY', $hostInstance->getRootHostKey());
	// 获得对应的根域名key
	// 如果访问根域名为test1.com或test2.com的地址,返回 online
	// 如果访问根域名为localhost的地址,返回 test
	$rootHostKey = $hostInstance->getRootHostKey();
	// 加载对应配置
	$configFile 	= 'yourDir' . $rootHostKey . '.php';
	if (file_exists($configFile)) {
		// 你的代码
		// define('ENV_CONFIG', require $configFile);
	} else {
		die('config file not exists.');
	}
} catch (\Throwable $e) {
	die('config error.');
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2648d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4bd0c4f0a704224c83065022cddc7e59a31d0242e539051d056bf66ee799b798?d=identicon)[lbzy](/maintainers/lbzy)

---

Top Contributors

[![lbzy](https://avatars.githubusercontent.com/u/11535519?v=4)](https://github.com/lbzy "lbzy (6 commits)")

### Embed Badge

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

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

PHPackages © 2026

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