PHPackages                             railken/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. railken/dotenv

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

railken/dotenv
==============

v0.1.2(7y ago)270MITPHPPHP &gt;=7.1

Since Dec 26Pushed 7y ago1 watchersCompare

[ Source](https://github.com/railken/dotenv)[ Packagist](https://packagist.org/packages/railken/dotenv)[ RSS](/packages/railken-dotenv/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

dotenv
======

[](#dotenv)

[![Build Status](https://camo.githubusercontent.com/b82dd85df14ba18dec700885d9a9de21649fc132d6f2ab63dda3cf51ff1598d2/68747470733a2f2f7472617669732d63692e6f72672f7261696c6b656e2f646f74656e762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/railken/dotenv)

This library is an extension of [Dotenv](https://github.com/vlucas/phpdotenv) that grants you the ability to update variables into the `.env` file. You can either update, append or remove a variable.

Requirements
============

[](#requirements)

PHP 7.1 and later.

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

[](#installation)

You can install it via [Composer](https://getcomposer.org/) by typing the following command:

```
composer require railken/dotenv
```

Usage
-----

[](#usage)

A simple usage looks like:

```
use Railken\Dotenv\Dotenv;

// Location of the directory that contains the .env file
$path = __DIR__;

$dotenv = new Dotenv($path);
$dotenv->load();

$dotenv->updateVariable("APP_KEY", "foo");
$dotenv->appendVariable("NEW_KEY", 2);
$dotenv->removeVariable("NEW_KEY");
```

The class `Railken\Dotenv\Dotenv` simply extends the class `Dotenv\Dotenv` as you can see [here](https://github.com/railken/dotenv/blob/master/src/Dotenv.php#L7)

If you wish you can use directly the `Railken\Dotenv\Storage`

```
use Railken\Dotenv\Storage;

// Location of the directory that contains the .env file
$path = __DIR__;

$storage = new Storage($path);
$storage->update("APP_KEY", "foo");
$storage->append("NEW_KEY", 2);
$storage->remove("NEW_KEY");
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~0 days

Total

3

Last Release

2696d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea4a9e56b247008aea4d20bb8a555a9f0cb69d0ac69aa8417b29fc37efa2eb5c?d=identicon)[railken](/maintainers/railken)

---

Top Contributors

[![railken](https://avatars.githubusercontent.com/u/26530231?v=4)](https://github.com/railken "railken (31 commits)")

---

Tags

dotenvenvenvironmentfilepersistputsetsetterstoreupdatedotenv

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/railken-dotenv/health.svg)

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

###  Alternatives

[yiithings/yii2-dotenv

PHP DotEnv for Yii2 framework

40574.5k7](/packages/yiithings-yii2-dotenv)[bnomei/kirby3-dotenv

Kirby Plugin for environment variables from .env

4144.1k1](/packages/bnomei-kirby3-dotenv)[beebmx/kirby-env

Enable env variables to Kirby

2037.9k2](/packages/beebmx-kirby-env)[nystudio107/dotenvy

Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents.

326.9k](/packages/nystudio107-dotenvy)[johannschopplich/kirby-helpers

Environment, SEO, and build utilities for Kirby CMS

277.4k](/packages/johannschopplich-kirby-helpers)

PHPackages © 2026

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