PHPackages                             dimer47/laravel-env-migrations - 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. dimer47/laravel-env-migrations

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

dimer47/laravel-env-migrations
==============================

Versioned migration system for Laravel's .env file, similar to database migrations.

1.0.1(1mo ago)07↓100%MITPHPPHP ^8.2

Since Mar 17Pushed 1mo agoCompare

[ Source](https://github.com/dimer47/laravel-env-migrations)[ Packagist](https://packagist.org/packages/dimer47/laravel-env-migrations)[ RSS](/packages/dimer47-laravel-env-migrations/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

⚙️ Laravel Env Migrations
=========================

[](#️-laravel-env-migrations)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d276a91967985acd3e7674bd3fa6a9d2556635e40ecf16bad14ff5604bcfef9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696d657234372f6c61726176656c2d656e762d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dimer47/laravel-env-migrations) [![Total Downloads](https://camo.githubusercontent.com/a98f6057a3c885647350a1eb20b0a901775b05239292fdbdd41a93add1469b14/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696d657234372f6c61726176656c2d656e762d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dimer47/laravel-env-migrations) [![PHP Version Require](https://camo.githubusercontent.com/111738a08a5d1854f6a2d826007b351db4802023c73e5761c202d5ecf5863524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f64696d657234372f6c61726176656c2d656e762d6d6967726174696f6e732f7068703f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/dimer47/laravel-env-migrations) [![Laravel](https://camo.githubusercontent.com/2b6edeb3665a17af5e541f00b14ed244610a3626facd3a0412d657935bfd3194/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125323025374325323031322d4646324432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://laravel.com) [![License](https://camo.githubusercontent.com/7130b8a6b4c32f68eb13ef4dbaa6da19b84a2988f054ccef2c159bae568212cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696d657234372f6c61726176656c2d656e762d6d6967726174696f6e733f7374796c653d666c61742d737175617265)](LICENSE)

> Versioned migration system for Laravel's `.env` file, similar to database migrations. 🗂️

🇫🇷 [Lire en français](README.fr.md)

🎉 Features
----------

[](#-features)

- 🔄 **Versioned migrations** — manage `.env` changes just like database migrations
- 📦 **Database tracking** — tracking table with batches and JSON history
- ⏪ **Rollback** — revert the last batch of changes
- 📊 **Status** — view the state of all migrations
- 🧩 **Laravel ready** — auto-discovery, publishable config, Artisan commands
- 🛡️ **Production safe** — mandatory confirmation in production (unless `--force`)
- 🔧 **11 methods** — set, get, remove, rename, copy, group, block, etc.

📍 Installation
--------------

[](#-installation)

### Via Composer (packagist)

[](#via-composer-packagist)

```
composer require dimer47/laravel-env-migrations
```

### 🧪 Via a local repository (development)

[](#-via-a-local-repository-development)

Add to the host project's `composer.json`:

```
{
    "repositories": [
        {
            "type": "path",
            "url": "packages/laravel-env-migrations"
        }
    ],
    "require": {
        "dimer47/laravel-env-migrations": "*"
    }
}
```

Then:

```
composer update dimer47/laravel-env-migrations
```

🔧 Configuration
---------------

[](#-configuration)

Publish the package files:

```
# Publish the config
php artisan vendor:publish --tag=env-migrations-config

# Publish the tracking table migration
php artisan vendor:publish --tag=env-migrations-migrations

# Run the migration
php artisan migrate
```

### ⚙️ Configuration options (`config/env-migrations.php`)

[](#️-configuration-options-configenv-migrationsphp)

OptionDescriptionDefault`table`Name of the tracking table`env_migrations``path`Directory for migration files`database/env-migrations`🚀 Quick Start
-------------

[](#-quick-start)

### ➕ Create a migration

[](#-create-a-migration)

```
php artisan env:migrate:make add_redis_configuration
```

This creates a file in `database/env-migrations/` with a ready-to-use template.

### ✏️ Write a migration

[](#️-write-a-migration)

```
