PHPackages                             italevski/env-diff - 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. italevski/env-diff

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

italevski/env-diff
==================

Check the difference between env files and actualize each other

1.0.1(1y ago)0101MITPHPPHP &gt;=8.2

Since Jun 6Pushed 1y agoCompare

[ Source](https://github.com/talevskiigor/env-diff)[ Packagist](https://packagist.org/packages/italevski/env-diff)[ RSS](/packages/italevski-env-diff/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

EnvDiff
=======

[](#envdiff)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cf4bc5ff6bf320d22fbae8d320f57e500299dc67112882059ff271fa815f5d0e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f54656b696c6c2f656e762d646966662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Tekill/env-diff)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1741a2c57344a20ef02a7aa82afcbe29b9ea28c37d9a83ddfba06516798c305b/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f54656b696c6c2f656e762d646966662f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Tekill/env-diff)[![Coverage Status](https://camo.githubusercontent.com/ddecd7090c4a2c1f53dd32718f3c938910ba4028ce3c62492d18b59b47d7d9a3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f54656b696c6c2f656e762d646966662e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Tekill/env-diff/code-structure/)[![Quality Score](https://camo.githubusercontent.com/4347d423da9db6be59b03ba2745cc201b86dc918b551ff95df2285c493cfa657/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f54656b696c6c2f656e762d646966662e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Tekill/env-diff)

EnvDiff is tool to compare environment keys to find the difference between .env files and actualize them.

[![Example cast](https://camo.githubusercontent.com/e7ff0f0f4d4ca1cff6ac92f75fa6e41fe47f238a625d425b15fa6ed69da99574/68747470733a2f2f6a2e676966732e636f6d2f7938524741362e676966)](https://camo.githubusercontent.com/e7ff0f0f4d4ca1cff6ac92f75fa6e41fe47f238a625d425b15fa6ed69da99574/68747470733a2f2f6a2e676966732e636f6d2f7938524741362e676966)

Installation
============

[](#installation)

```
composer require tekill/env-diff

```

Manual running
--------------

[](#manual-running)

### Actualize variables

[](#actualize-variables)

Compare `.env` with `.env.dist` and add missing variables to `.env` file.

```
php ./vendor/bin/env-diff actualize

```

Compare `.env` with `.env.example` and add missing variables to `.env` file.

```
php ./vendor/bin/env-diff actualize .env.example

```

Compare `.env-target` with `.env.example` and add missing variables to `.env-target` file.

```
php ./vendor/bin/env-diff actualize .env.example .env-target

```

If you want to delete outdated values just run command with `-k=false` option.

```
php ./vendor/bin/env-diff actualize -k=false

```

### Show differences

[](#show-differences)

Command has same interface, arguments and options.

Compare `.env` with `.env.dist` and show differences between them.

```
php ./vendor/bin/env-diff diff

```

Composer script
---------------

[](#composer-script)

Add code block in `composer.json`:

```
"scripts": {
    "post-update-cmd": "LF\\EnvDiff\\Composer\\ScriptHandler::actualizeEnv"
}

```

The `.env` will then be created or updated by the composer script, to match the structure of the dist file `.env.dist` by asking you the missing variables.

By default, the dist file is assumed to be in the same place than the target `.env`file, suffixed by `.dist`. This can be changed in the configuration:

```
{
    "extra": {
        "lf-env-diff": [
            {
                "dist": "path/to/env.dist",
                "target": "path/to/.env"
            }
        ]
    }
}
```

The script handler will ask you interactively for variables which are missing in the target env file, using the value of the dist file as default value. If composer is run in a non-interactive mode `--no-interaction`, the values of the dist file will be used for missing variables.

**Warning:** This handler will overwrite any comments or spaces into your target `.env` file so handle with care.

### Managing multiple ignored files

[](#managing-multiple-ignored-files)

The handler can manage multiple ignored files. To use this feature, the `lf-env-diff` extra should contain a JSON array with multiple configurations inside it instead of a configuration object:

```
{
    "extra": {
        "lf-env-diff": [
            {
                 "dist": "path/to/.env.dist",
                 "target": "path/to/.env"
            },
            {
                 "dist": "path/to/.env.dist",
                 "target": "path/to/.env-test",
                 "keep-outdated": false
            }
        ]
    }
}
```

### Show difference

[](#show-difference)

Add code block in `composer.json`:

```
"scripts": {
    "post-update-cmd": "LF\\EnvDiff\\Composer\\ScriptHandler::showDifference"
}

```

This handler has same behavior as described before.

Git hooks
---------

[](#git-hooks)

You can use Git hook that gets triggered after any 'git pull' whenever one of the files specified has changed. Useful to update any web application dependency or sync configuration.

Create `post-merge` hook in `.git/hooks` directory of your project:

```
#/usr/bin/env bash

changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"

check_run() {
  echo "$changed_files" | grep -E --quiet "$1" && eval "$2"
}

# Actualize env files if the `env.dist` file gets changed
check_run env.dist "php ./vendor/bin/env-diff actualize"

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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 ~0 days

Total

2

Last Release

711d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cda0382de62dd8ac1c5d8ee05cdd4fde878353e3444c7d5ebadd6a67c404c54?d=identicon)[a87c81](/maintainers/a87c81)

---

Top Contributors

[![Tekill](https://avatars.githubusercontent.com/u/965890?v=4)](https://github.com/Tekill "Tekill (15 commits)")[![talevskiigor](https://avatars.githubusercontent.com/u/6525038?v=4)](https://github.com/talevskiigor "talevskiigor (2 commits)")[![craigruks](https://avatars.githubusercontent.com/u/69945?v=4)](https://github.com/craigruks "craigruks (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/italevski-env-diff/health.svg)

```
[![Health](https://phpackages.com/badges/italevski-env-diff/health.svg)](https://phpackages.com/packages/italevski-env-diff)
```

###  Alternatives

[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

4743.5k10](/packages/phel-lang-phel-lang)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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