PHPackages                             jobmetric/laravel-env-modifier - 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. jobmetric/laravel-env-modifier

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

jobmetric/laravel-env-modifier
==============================

This is a package for env modification the contents of different Laravel projects.

2.2.1(5mo ago)824↓90%2[31 PRs](https://github.com/jobmetric/laravel-env-modifier/pulls)MITPHPPHP &gt;=8.0.1CI failing

Since Oct 24Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/jobmetric/laravel-env-modifier)[ Packagist](https://packagist.org/packages/jobmetric/laravel-env-modifier)[ Docs](https://doc.jobmetric.net/package/laravel-env-modifier)[ GitHub Sponsors](https://github.com/sponsors/majidmohammadian)[ RSS](/packages/jobmetric-laravel-env-modifier/feed)WikiDiscussions master Synced 3w ago

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

[![Contributors](https://camo.githubusercontent.com/326381adf810e16a2c16aa7121564023fadf81ff4dd1396f16805d3c17292a8c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f6a6f626d65747269632f6c61726176656c2d656e762d6d6f6469666965722e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-env-modifier/graphs/contributors)[![Forks](https://camo.githubusercontent.com/7b653e46f48303f3d9fa5ed13158983116e0784035093655abad90ffd3da41e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6a6f626d65747269632f6c61726176656c2d656e762d6d6f6469666965722e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d466f726b)](https://github.com/jobmetric/laravel-env-modifier/network/members)[![Stargazers](https://camo.githubusercontent.com/47c92ba9d9c457021afe84f3333f8dd4cb20b2cfc2d4b23865c92c9c583f2b5a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6a6f626d65747269632f6c61726176656c2d656e762d6d6f6469666965722e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-env-modifier/stargazers)[![MIT License](https://camo.githubusercontent.com/a4a7dacbed870f9a61339e2b87b9f6de719a7a40e92ed8d65853c993962ac3f1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6f626d65747269632f6c61726176656c2d656e762d6d6f6469666965722e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/jobmetric/laravel-env-modifier/blob/master/LICENCE.md)[![LinkedIn](https://camo.githubusercontent.com/eb590f47a3fca74584d18db8dd3e985ae3d786f50cd41b7530c3af3885da233c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d4c696e6b6564496e2d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6c696e6b6564696e26636f6c6f72423d353535)](https://linkedin.com/in/majidmohammadian)

Laravel Env Modifier
====================

[](#laravel-env-modifier)

**Manage .env Files. Safely and Easily.**

Laravel Env Modifier simplifies working with `.env` files in Laravel applications. Stop managing environment files manually and start automating configuration management with confidence. It provides a clean API to create, read, merge, update, back up, restore, and delete `.env` files safely and predictably—perfect for deployment scripts, environment management, and configuration automation. This is where powerful file management meets developer-friendly simplicity—giving you complete control over your environment configuration without the complexity.

Why Laravel Env Modifier?
-------------------------

[](#why-laravel-env-modifier)

### Safe File Operations

[](#safe-file-operations)

Laravel Env Modifier uses atomic writes with `LOCK_EX` to prevent race conditions when multiple processes access the same `.env` file. It also includes protection mechanisms to prevent accidental deletion of your main application `.env` file.

### Smart Value Handling

[](#smart-value-handling)

The package automatically handles value normalization, escaping, and quoting. It intelligently quotes values containing spaces, special characters, or newlines, and properly handles booleans, arrays, and JSON data.

### Preserves Comments and Formatting

[](#preserves-comments-and-formatting)

Unlike many `.env` manipulation tools, Laravel Env Modifier preserves comments and blank lines in your `.env` files. It only modifies the specific keys you target, leaving the rest of your file structure intact.

### Multiple File Support

[](#multiple-file-support)

Work with multiple `.env` files simultaneously. Create environment-specific files (`.env.staging`, `.env.testing`), merge configurations from templates, and manage different environments without code changes.

What is Env File Management?
----------------------------

[](#what-is-env-file-management)

Env file management is the process of programmatically reading, writing, and modifying environment configuration files. Traditional approaches often involve manual editing or fragile string manipulation, but Laravel Env Modifier provides a robust, safe solution:

- **Atomic Operations**: All file writes use exclusive locks to prevent corruption
- **Key-Level Operations**: Read, write, rename, and delete individual keys without affecting others
- **File-Level Operations**: Create, backup, restore, and delete entire `.env` files
- **Merge Capabilities**: Combine configurations from multiple files with filtering options
- **Value Normalization**: Automatically handles quoting, escaping, and type conversion

Consider a deployment script that needs to update environment variables based on the deployment environment. With Laravel Env Modifier, you can create environment-specific files, merge configurations from templates, set defaults, create backups before risky operations, and restore if something goes wrong. The power of env file management lies not only in programmatic access but also in making it safe, predictable, and easy to use throughout your application.

What Awaits You?
----------------

[](#what-awaits-you)

By adopting Laravel Env Modifier, you will:

- **Automate deployments** - Programmatically configure environments during deployment
- **Simplify environment management** - Manage multiple environments with ease
- **Improve safety** - Atomic writes and main `.env` protection prevent accidents
- **Preserve file structure** - Comments and formatting remain intact
- **Handle complex values** - Automatic normalization for booleans, arrays, and JSON
- **Maintain clean code** - Simple, intuitive API that follows Laravel conventions

Quick Start
-----------

[](#quick-start)

Install Laravel Env Modifier via Composer:

```
composer require jobmetric/laravel-env-modifier
```

Documentation
-------------

[](#documentation)

Ready to transform your Laravel applications? Our comprehensive documentation is your gateway to mastering Laravel Env Modifier:

**[📚 Read Full Documentation →](https://jobmetric.github.io/packages/laravel-env-modifier/)**

The documentation includes:

- **Getting Started** - Quick introduction and installation guide
- **EnvModifier** - Complete API reference for file and key operations
- **File Operations** - Create, backup, restore, delete, and merge `.env` files
- **Key Operations** - Read, write, rename, delete, and check existence of keys
- **Value Normalization** - Automatic handling of booleans, arrays, JSON, and special characters
- **Helper Functions** - Convenient global helpers for common operations
- **Real-World Examples** - See how it works in practice

Contributing
------------

[](#contributing)

Thank you for participating in `laravel-env-modifier`. A contribution guide can be found [here](CONTRIBUTING.md).

License
-------

[](#license)

The `laravel-env-modifier` is open-sourced software licensed under the MIT license. See [License File](LICENCE.md) for more information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance77

Regular maintenance activity

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.4% 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 ~165 days

Recently: every ~192 days

Total

6

Last Release

152d ago

Major Versions

1.1.0 → 2.0.02025-09-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/b00d08bd4b0b765ee2d33719a535e6cb49c04fb945078a0809d5c05e6f16ee96?d=identicon)[majidmohammadian](/maintainers/majidmohammadian)

---

Top Contributors

[![MajidMohammadian](https://avatars.githubusercontent.com/u/2099965?v=4)](https://github.com/MajidMohammadian "MajidMohammadian (18 commits)")[![Bagheri-Matin](https://avatars.githubusercontent.com/u/239607447?v=4)](https://github.com/Bagheri-Matin "Bagheri-Matin (17 commits)")

---

Tags

envenv-modifierenvironmentenvironment-variableslaravellaravel-packagepackagelaravelpackageenvjobmetricenv-fileenv modifier

### Embed Badge

![Health badge](/badges/jobmetric-laravel-env-modifier/health.svg)

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

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[creasi/laravel-nusa

A Laravel package that aim to provide Indonesia' Administrative Data

997.7k2](/packages/creasi-laravel-nusa)[pdazcom/laravel-referrals

A referrals system for a laravel projects.

291.5k](/packages/pdazcom-laravel-referrals)

PHPackages © 2026

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