sixlive/dotenv-editor

A tool to edit phpdotenv files

Maintainers

👁 sixlive

Package info

github.com/sixlive/dotenv-editor

pkg:composer/sixlive/dotenv-editor

Fund package maintenance!

sixlive

Statistics

Installs: 1 590 017

Dependents: 15

Suggesters: 0

Stars: 74

Open Issues: 2

v2.1.0 2025-09-08 18:03 UTC

Requires

  • php: ^8.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT ba634c0d637cc4d1b2d3a7bf64a0c9407d0d8d94

dotenvphpdotenvdotenv-editor

This package is auto-updated.

Last update: 2026-06-08 20:02:25 UTC


README

👁 Latest Version on Packagist
👁 Total Downloads
👁 run-tests

This package provides some basic tools for editing dotenv files.

Installation

You can install the package via composer:

> composer require sixlive/dotenv-editor

Usage

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

> vendor/bin/phpunit

Code Style

StyleCI will apply the Laravel preset.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

The MIT License (MIT). Please see License File for more information.