New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

aranyasen/laravel-env-sync

A package that makes sure that your .env file is in sync with your .env.example
23,423 4
Install
composer require aranyasen/laravel-env-sync
Latest Version:v3.0.1
PHP:>=8.2
Laravel:10 – 13
Older releases:8 · 9
License:MIT
Last Updated:Sep 1, 2026
Links: GitHub  ·  Packagist
Maintainer: senaranya

Tests Current Version Total Downloads License Codecov Coverage

Keep your .env in sync with your .env.example or vice versa.

It reads the .env.example file and makes suggestions to fill your .env accordingly.

Installation via Composer

Start by requiring the package with composer

composer require aranyasen/laravel-env-sync

Usage

Sync your dotenv files

You can populate your .env file from the .env.example by using the php artisan env:sync command.

The command will tell you if there's anything not in sync between your files and will propose values to add into the .env file.

You can launch the command with the option --reverse to fill the .env.example file from the .env file

You can also use --src and --dest to specify which file you want to use. You must use either both flags, or none.

If you use the --no-interaction flag, the command will copy all new keys with their default values.

Check for diff in your dotenv files

You can check if your .env is missing some variables from your .env.example by using the php artisan env:check command.

The command simply show you which keys are not present in your .env file. This command will return 0 if your files are in sync, and 1 if they are not, so you can use this in a script

Again, you can launch the command with the option --reverse or with --src and --dest.

The command will also dispatch event Aranyasen\LaravelEnvSync\Events\MissingEnvVars, which will contain the missing env variables, which could be used in automatic deployments. Event is only fired when there are missing env variables.

Show diff between your dotenv files

You can show a table that compares the content of your env files by using the php artisan env:diff command.

The command will print a table that compares the content of both .env and .env.example files, and will highlight the missing keys.

You can launch the command with the options --src and --dest.

Related Packages

poojajadav/hasmanysync

This trait can be sync data for hasmany relationship.

1,541 1
jackiedo/dotenv-editor

The .env file editor tool for Laravel 5.8+

1,332,103 204
brotzka/laravel-dotenv-editor

A package for editing the .env file in your Laravel root.

178,997 371
koel/dotenv-editor

The .env file editor tool for Laravel 11+

23,415 1
pixelfed/dotenv-editor

The .env file editor tool for Laravel 5+

8,243 0

Version History

Version Released PHP Laravel License
v3.0.1 >=8.2 ^10|^11|^12|^13 MIT
v3.0.0 >=8.2 ^10|^11|^12|^13 MIT
v2.0.2 >=8.1 ^10|^11 MIT
v2.0.1 >=8.1 ^10 MIT
v2.0.0 >=8.1 ^10 MIT