php-prosvirin-dev / laravel-env-sync
Sync .env.example with .env file in Laravel
Package info
github.com/php-prosvirin-dev/laravel-env-sync
pkg:composer/php-prosvirin-dev/laravel-env-sync
v1.0.0
2026-03-23 16:11 UTC
Requires
- php: ^8.1
- illuminate/console: ^10.0|^11.0|^12.0|^13.0
- illuminate/filesystem: ^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- laravel/pint: ^1.0
- orchestra/testbench: ^8.0|^9.0|^10.0|^11.0
- pestphp/pest: ^2.0|^3.0
README
A Laravel package that synchronizes your .env.example with .env file.
Features
- Auto-sync - Adds missing variables from .env.example to .env
- No overwrites - Preserves existing values
- Extra variables detection
- Backup support before force sync
- Interactive add new variables
- Interactive remove variables
- Force sync with backup
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
Installation
composer require php-prosvirin-dev/laravel-env-sync --dev
Usage
Basic sync:
php artisan env:sync
Force sync with backup:
php artisan env:sync --force
Add new variable:
php artisan env:sync --add
Remove variable:
php artisan env:sync --remove
CI/CD Integration
Use this package in your CI/CD pipeline to ensure .env files are always in sync with .env.example:
name: Check Environment Consistency on: [push, pull_request] jobs: check-env: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install Dependencies run: composer install - name: Check .env Consistency run: | php artisan env:sync git diff --exit-code
License
MIT