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

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

sixlive/dotenv-editor
=====================

A tool to edit phpdotenv files

v2.1.0(8mo ago)761.5M—0.6%6[1 PRs](https://github.com/sixlive/dotenv-editor/pulls)11MITPHPPHP ^8.0CI passing

Since Aug 17Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/sixlive/dotenv-editor)[ Packagist](https://packagist.org/packages/sixlive/dotenv-editor)[ Docs](https://github.com/sixlive/dotenv-editor)[ GitHub Sponsors](https://github.com/sixlive)[ RSS](/packages/sixlive-dotenv-editor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (9)Used By (11)

Dotenv editing toolset
======================

[](#dotenv-editing-toolset)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fc542f5bec5fff2557d28ac2fcebfac87f8a57c2b5042915ecf2f54dbcb6b460/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369786c6976652f646f74656e762d656469746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sixlive/dotenv-editor)[![Total Downloads](https://camo.githubusercontent.com/f0e6edb7477ed1ae21fd2db5a0b0f435445532f2812b6cd06280b02630cb0207/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369786c6976652f646f74656e762d656469746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sixlive/dotenv-editor)[![run-tests](https://github.com/sixlive/dotenv-editor/workflows/run-tests/badge.svg)](https://github.com/sixlive/dotenv-editor/workflows/run-tests/badge.svg)

This package provides some basic tools for editing dotenv files.

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

[](#installation)

You can install the package via composer:

```
> composer require sixlive/dotenv-editor
```

Usage
-----

[](#usage)

### Add a section

[](#add-a-section)

Given we have an existing file at `base_path('.env')`.

```
APP_KEY=supersecret
APP_FOO=BAR

```

We can add a new section to the existing configuration file.

```
$editor = new DotenvEditor;

$editor->load(base_path('.env'));
$editor->heading('Examples');
$editor->set('FOO', 'bar');
$editor->set('BAZ', 'bax');
$editor->unset('APP_FOO');
$editor->save();
```

This will result in the following changes.

```
APP_KEY=supersecret

# Examples
FOO=bar
BAZ=bax

```

Testing
-------

[](#testing)

```
> vendor/bin/phpunit
```

Code Style
----------

[](#code-style)

StyleCI will apply the [Laravel preset](https://docs.styleci.io/presets#laravel).

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [TJ Miller](https://github.com/sixlive)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance60

Regular maintenance activity

Popularity53

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 81.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 ~430 days

Recently: every ~625 days

Total

7

Last Release

252d ago

Major Versions

v1.3.0 → v2.0.02021-11-15

PHP version history (3 changes)v1.0.0PHP ^7.1|^7.2

v1.3.0PHP ^7.1|^8.0

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5108034?v=4)[TJ Miller](/maintainers/sixlive)[@sixlive](https://github.com/sixlive)

---

Top Contributors

[![sixlive](https://avatars.githubusercontent.com/u/5108034?v=4)](https://github.com/sixlive "sixlive (13 commits)")[![caneco](https://avatars.githubusercontent.com/u/502041?v=4)](https://github.com/caneco "caneco (1 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![michaeldyrynda](https://avatars.githubusercontent.com/u/558441?v=4)](https://github.com/michaeldyrynda "michaeldyrynda (1 commits)")

---

Tags

dotenvdotenv-editorphpdotenvphpdotenvdotenv-editor

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k226.7M2.3k](/packages/symfony-dotenv)[jackiedo/dotenv-editor

The .env file editor tool for Laravel 5.8+

2041.2M31](/packages/jackiedo-dotenv-editor)[josegonzalez/dotenv

dotenv file parsing for PHP

2799.8M137](/packages/josegonzalez-dotenv)[helhum/dotenv-connector

Makes it possible to set environment variables for composer projects.

1594.6M34](/packages/helhum-dotenv-connector)[m1/env

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

6412.0M21](/packages/m1-env)

PHPackages © 2026

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