PHPackages                             saff-elli-khan/dotenv - 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. saff-elli-khan/dotenv

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

saff-elli-khan/dotenv
=====================

A dynamic environment variables &amp; configuration managment library.

20PHP

Since Mar 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Saff-Elli-Khan/Dotenv)[ Packagist](https://packagist.org/packages/saff-elli-khan/dotenv)[ RSS](/packages/saff-elli-khan-dotenv/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Epic-dotenv
===========

[](#epic-dotenv)

A dynamic environment variables &amp; configuration managment library.

Language
--------

[](#language)

> PHP

Features
--------

[](#features)

- Get Enviroment Variables
- Resolve ENV File
- Create/Update/Remove Variables
- Validate Variables

Composer Installation
---------------------

[](#composer-installation)

> composer require saff-elli-khan/dotenv

### Usage

[](#usage)

Its a very easy to use library!

```
use Dotenv\Dotenv\Dotenv;
use Dotenv\DotenvExceptions\DotenvExceptions;

require_once 'vendor/autoload.php';

try {

    //File Path In First Parameter.
    //Setting Parameter 2 To True Automatically Generates The ENV File If Not Exists (Default False).
    //Setting Parameter 3 To False Disables Exceptions And The Library Returns False On Error (Default True).

    $dotenv = new Dotenv(".env", true);
    $dotenv->load();

} catch (DotenvExceptions $e) {
    print_r($e->getMessage());
}

```

#### Methods

[](#methods)

##### Get

[](#get)

```

$dotenv->get($variableName); //Return Data

getenv($variableName); //Alternative

$_ENV[$variableName]; //Alternative

```

##### Create/Update

[](#createupdate)

```
//Parameter 1 Is An Array Containing Variable Names And Values.
//Parameter 2 Is An Optional Comment String.
//Will Update A Variable If Already Exists.
//Method ->put() Is Required To Be Called To Commit The Action.

$dotenv->addVariables(["Foo" => "Bar"], "A test comment")->put();

```

##### Remove

[](#remove)

```
//Parameter 1 Is An Array Containing Variable Names To Be Removed.
//Method ->put() Is Required To Be Called To Commit The Action.

$dotenv->removeVariables(["Foo", "Moo"])->put();

```

##### Validations

[](#validations)

```
//Call ->options() Method First To Initialize Validations.
//Parameter 1 To ->required() Method Is An Array Containing Variable Names That Are Required.

$dotenv->options()->required(["Foo", "Moo"]);

```

###### Advance Validation

[](#advance-validation)

```
//Call A Third Method On ->required() Method Like is_email() To Validate All Required Variables

$dotenv->options()->required(["Foo", "Moo"])->is_email();

```

##### Validation Methods

[](#validation-methods)

- is\_ip();
- not\_empty();
- is\_empty();
- is\_match($regex);
- is\_url();
- is\_userName();
- is\_contact(fales); //Set True If Want Just Integer Validation
- is\_email();
- is\_string();
- is\_numuric();
- is\_integer();
- is\_float();

Sorry for any type of mistakes, Let us know what do you think about this library? Thanks!

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/89b594a0f2c7551c8b2bf329b312f70866d9c39cc038e6df7f2c53cf702b8be7?d=identicon)[Saff-Elli-Khan](/maintainers/Saff-Elli-Khan)

---

Top Contributors

[![Saff-Elli-Khan](https://avatars.githubusercontent.com/u/62799255?v=4)](https://github.com/Saff-Elli-Khan "Saff-Elli-Khan (2 commits)")

### Embed Badge

![Health badge](/badges/saff-elli-khan-dotenv/health.svg)

```
[![Health](https://phpackages.com/badges/saff-elli-khan-dotenv/health.svg)](https://phpackages.com/packages/saff-elli-khan-dotenv)
```

###  Alternatives

[kris/laravel-form-builder

Laravel form builder - symfony like

1.7k2.2M45](/packages/kris-laravel-form-builder)

PHPackages © 2026

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