PHPackages                             proximitymad/detectenv - 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. proximitymad/detectenv

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

proximitymad/detectenv
======================

A simple PHP class to detect environment depending on server name

v1.0.2(9y ago)05361PHPPHP &gt;=5.4.0

Since Nov 7Pushed 9y ago4 watchersCompare

[ Source](https://github.com/proximity-mad/detectenv)[ Packagist](https://packagist.org/packages/proximitymad/detectenv)[ RSS](/packages/proximitymad-detectenv/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

detectenv
=========

[](#detectenv)

Simple PHP Class to get environment depending on server name

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist proximitymad/detectenv "1.0.*"

```

or add

```
"proximitymad/detectenv": "1.0.*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
$hosts = [
    'mydevhost.dev'=>'dev',
    'mytesthost.com'=>'test',
    'myprodhost.com'=>'prod',
    'myHostName'=>'console',
];
$env = \proximitymad\detectenv\DetectEnv::get($hosts);
```

By default if no host is found it will return null, you can change the default host by adding the second parameter:

```
$env = \proximitymad\detectenv\DetectEnv::get($hosts, 'prod');
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 73.3% 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 ~4 days

Total

3

Last Release

3506d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7389153?v=4)[Proximity New Zealand](/maintainers/proximity)[@proximity](https://github.com/proximity)

---

Top Contributors

[![nvanderburg](https://avatars.githubusercontent.com/u/73654874?v=4)](https://github.com/nvanderburg "nvanderburg (11 commits)")[![nilsburg](https://avatars.githubusercontent.com/u/1023621?v=4)](https://github.com/nilsburg "nilsburg (3 commits)")[![reymad](https://avatars.githubusercontent.com/u/14904210?v=4)](https://github.com/reymad "reymad (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/proximitymad-detectenv/health.svg)

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

###  Alternatives

[vinicius73/seotools

A package containing SEO helpers.

235.2k](/packages/vinicius73-seotools)

PHPackages © 2026

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