Skip to content
A PHP Package for editing dotenv files
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
src
tests
.editorconfig
.gitattributes
.gitignore
.php_cs
.scrutinizer.yml
.styleci.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
phpunit.xml.dist

README.md

Dotenv editing toolset

Latest Version on Packagist Total Downloads Build Status Quality Score Code Coverage StyleCI

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

In addition to the php-cs-fixer rules, StyleCI will apply the Laravel preset.

> composer styles:lint
> composer styles:fix

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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.