PHPackages                             romanzipp/laravel-env-normalizer - 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. romanzipp/laravel-env-normalizer

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

romanzipp/laravel-env-normalizer
================================

Format .env files according to your .env.example structure to keep track of used and unused variables

1.3.0(1y ago)17.0kMITPHPPHP ^8.0CI passing

Since Oct 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/romanzipp/Laravel-Env-Normalizer)[ Packagist](https://packagist.org/packages/romanzipp/laravel-env-normalizer)[ GitHub Sponsors](https://github.com/romanzipp)[ RSS](/packages/romanzipp-laravel-env-normalizer/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (8)Versions (9)Used By (0)

Laravel Env Normalizer
======================

[](#laravel-env-normalizer)

[![Latest Stable Version](https://camo.githubusercontent.com/e93f61b423ad22bc496b22e62ac52160833c2fc3887e2abafa019f00fb548446/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f6d616e7a6970702f4c61726176656c2d456e762d4e6f726d616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/romanzipp/laravel-env-normalizer)[![Total Downloads](https://camo.githubusercontent.com/b727be03449428ac127314265585ff8f08f06c4ea2cbb319f7143ac8cca39d55/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f6d616e7a6970702f4c61726176656c2d456e762d4e6f726d616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/romanzipp/laravel-env-normalizer)[![License](https://camo.githubusercontent.com/e6a34041805dea80705469b028f7a9927f5178d5869aab0e924f7662c3c3e176/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f726f6d616e7a6970702f4c61726176656c2d456e762d4e6f726d616c697a65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/romanzipp/laravel-env-normalizer)[![GitHub Build Status](https://camo.githubusercontent.com/c265b43bb6494cd96586908888917aed6251d5e71e5907ef6e8a23327bad5570/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f726f6d616e7a6970702f4c61726176656c2d456e762d4e6f726d616c697a65722f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/romanzipp/Laravel-Env-Normalizer/actions)

Format `.env` files according to your `.env.example` structure to keep track of used and unused variables.

#### Why?

[](#why)

I like to keep a clear overview of all available environment variables by adding some default values to my version controled `.env.example` file. This packages helps with structuring your example files.

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Roadmap](#roadmap)
- [Testing](#testing)

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

[](#installation)

```
composer require romanzipp/laravel-env-normalizer --dev
```

Usage
-----

[](#usage)

```
php artisan env:normalize
```

#### List all available options

[](#list-all-available-options)

```
php artisan env:normalize --help
```

#### Specify reference and target file(s)

[](#specify-reference-and-target-files)

Reference and target options are optional. If not specified the command will only look for a `.env.example` (as reference) and `.env` file (as target).

```
php artisan env:normalize --reference=.env.example --target=.env --target=.env.local
```

#### Automatically format all other .env files

[](#automatically-format-all-other-env-files)

This option will discover any other `.env.*` files located in the base path and add them to the target list.

```
php artisan env:normalize --auto
```

#### Create backup files

[](#create-backup-files)

This will create a `{name}.bak` backup file for each modified target file.

```
php artisan env:normalize --backup
```

#### Dry run

[](#dry-run)

Log the expected output to the console instead of writing it to the file.

```
php artisan env:normalize --dry
```

### Example normalization

[](#example-normalization)

`.env.example`previous `.env`new `.env````
BASE_URL=localhost # DatabaseDB_HOST=127.0.0.1DB_PORT=${DEFAULT_PORT}DB_USER=DB_PASSWORD=# MailMAIL_CONNECTION=
```

```
DB_HOST=10.0.0.10BASE_URL=me.comDB_USER=prodDB_PASSWORD=123456# MailMAIL_CONNECTION=fooMAIL_USER=tim#DEV_PW=123
```

```
BASE_URL=me.com # DatabaseDB_HOST=10.0.0.10DB_USER=prodDB_PASSWORD=123456# MailMAIL_CONNECTION=foo# AdditionalMAIL_USER=tim# Unset#DEV_PW=123
```

- The base structure for all target `.env` files will be taken from the reference `.env.example` file
- Values will be replaced with the existing content
- Unused (not overwritten) example variables will not be added
- Additional variables from the `.env` file will be appended to the bottom so you can later add them to your version controled example file
- Commented lines `#FOO=bar` which do not start with hash + space `# ` will be appended to the end

Roadmap
-------

[](#roadmap)

- Detect similar variables and position them below existing ones (place `MAIL_FROM` below `MAIL_CONNECTION` instead of appendin it to the end)

Testing
-------

[](#testing)

```
./vendor/bin/phpunit

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance46

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~178 days

Recently: every ~284 days

Total

8

Last Release

417d ago

Major Versions

0.0.2 → 1.0.02021-10-14

PHP version history (2 changes)0.0.1PHP ^7.4|^8.0

1.2.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/309ea408cc915d1d37b370796df57a24ec31f0b65da69f69c650c8983f9c33a6?d=identicon)[romanzipp](/maintainers/romanzipp)

---

Top Contributors

[![romanzipp](https://avatars.githubusercontent.com/u/11266773?v=4)](https://github.com/romanzipp "romanzipp (57 commits)")

---

Tags

laravellaravel-packagephpshowcase

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/romanzipp-laravel-env-normalizer/health.svg)

```
[![Health](https://phpackages.com/badges/romanzipp-laravel-env-normalizer/health.svg)](https://phpackages.com/packages/romanzipp-laravel-env-normalizer)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M157](/packages/orchestra-canvas)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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