PHPackages                             lithemod/env - 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. lithemod/env

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

lithemod/env
============

A simple environment variable loader and manager for PHP applications.

v1.0.0(1y ago)13063MITPHPPHP ^7.4 || ^8.0

Since Oct 2Pushed 1y agoCompare

[ Source](https://github.com/lithemod/env)[ Packagist](https://packagist.org/packages/lithemod/env)[ RSS](/packages/lithemod-env/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (3)

Lithe Env
=========

[](#lithe-env)

A simple environment variable loader and manager for PHP applications.

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

[](#installation)

You can install the `lithemod/env` package via Composer. Run the following command in your terminal:

```
composer require lithemod/env
```

Usage
-----

[](#usage)

### Loading Environment Variables

[](#loading-environment-variables)

To load environment variables from a `.env` file, use the `load` method:

```
use Lithe\Support\Env;

// Load environment variables from the specified path
Env::load(__DIR__);
```

### Getting Environment Variables

[](#getting-environment-variables)

To retrieve the value of an environment variable, use the `get` method:

```
$value = Env::get('MY_VARIABLE', 'default_value');
```

### Setting Environment Variables

[](#setting-environment-variables)

To set an environment variable, use the `set` method:

```
Env::set('MY_VARIABLE', 'my_value');
```

### Checking if an Environment Variable Exists

[](#checking-if-an-environment-variable-exists)

You can check if an environment variable is defined using the `has` method. It accepts either a string or an array of keys:

```
if (Env::has('MY_VARIABLE')) {
    // The environment variable is defined
}

if (Env::has(['VAR_ONE', 'VAR_TWO'])) {
    // At least one of the variables is defined
}
```

Example
-------

[](#example)

Here’s a quick example of how to use the `Env` class in your application:

```
require 'vendor/autoload.php';

use Lithe\Support\Env;

// Load the .env file
Env::load(__DIR__);

// Get a variable
$dbHost = Env::get('DB_HOST', 'localhost');
echo "Database Host: " . $dbHost;

// Set a variable
Env::set('MY_VARIABLE', 'Hello, World!');

// Check if a variable exists
if (Env::has('MY_VARIABLE')) {
    echo "MY_VARIABLE is set!";
}
```

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity44

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

593d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/56173de3a7bf7099dd8168efd730d3c2fb5df5174a123fdc37cee8c3589e2345?d=identicon)[williamhumbwavali](/maintainers/williamhumbwavali)

---

Top Contributors

[![williamhumbwavali](https://avatars.githubusercontent.com/u/127023095?v=4)](https://github.com/williamhumbwavali "williamhumbwavali (1 commits)")

---

Tags

envmodulephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lithemod-env/health.svg)

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

###  Alternatives

[roots/bedrock

WordPress boilerplate with Composer, easier configuration, and an improved folder structure

6.5k441.8k2](/packages/roots-bedrock)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[blair2004/nexopos

The Free Modern Point Of Sale System build with Laravel, TailwindCSS and Vue.js.

1.2k2.3k](/packages/blair2004-nexopos)[lullabot/drainpipe

An automated build tool to allow projects to have a set standardized operations scripts.

41716.4k2](/packages/lullabot-drainpipe)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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