PHPackages                             akmnahid/laravel-local-env-support - 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. akmnahid/laravel-local-env-support

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

akmnahid/laravel-local-env-support
==================================

The laravel-local-env-support plugin allows Laravel developers to seamlessly integrate environment-specific .env.local configurations, enhancing adaptability across different development stages.

v1.0.3(1y ago)16MITPHPPHP &gt;=7.3

Since Aug 25Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (5)Used By (0)

Laravel EnvLocal Support
========================

[](#laravel-envlocal-support)

[![License](https://camo.githubusercontent.com/50664df79c3f65d35f897f03a9a776c93e7746d3f08cf7a7818129ce679b142b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616b6d6e616869642f6c61726176656c2d6c6f63616c2d656e762d737570706f7274)](https://camo.githubusercontent.com/50664df79c3f65d35f897f03a9a776c93e7746d3f08cf7a7818129ce679b142b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616b6d6e616869642f6c61726176656c2d6c6f63616c2d656e762d737570706f7274)[![Total Downloads](https://camo.githubusercontent.com/35ad70bced3528f106ec7a537ac424475cb44e1445092e6770d42fcca6f02fce/68747470733a2f2f706f7365722e707567782e6f72672f616b6d6e616869642f6c61726176656c2d6c6f63616c2d656e762d737570706f72742f646f776e6c6f616473)](https://packagist.org/packages/akmnahid/laravel-local-env-support)

A Laravel package to add support for `.env.local` files, allowing you to override environment variables defined in the main `.env` file without modifying it. This is particularly useful for local development and testing environments.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Features](#features)
- [Requirements](#requirements)
- [License](#license)

---

Installation
------------

[](#installation)

You can install this package via Composer:

```
composer require akmnahid/laravel-local-env-support
```

To install directly from VCS repository in your `composer.json`:

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/akmnahid/laravel-local-env-support"
        }
    ],
    "require": {
        "akmnahid/laravel-local-env-support": "dev-main"
    }
}
```

Then run:

```
composer update
```

---

Usage
-----

[](#usage)

1. **Create a `.env.local` file** in the root directory of your Laravel project.
2. **Add environment variables** to `.env.local` that you wish to override from the main `.env` file.

    **Example `.env.local`:**

    ```
    APP_DEBUG=true
    DB_HOST=localhost
    ```
3. **Ensure `.env.local` is added to your `.gitignore`** file to prevent it from being committed to version control.
4. **Clear the configuration cache** if you have previously cached your configurations:

    ```
    php artisan config:clear
    ```
5. **Run your application** as usual. Variables defined in `.env.local` will override those in `.env`.

---

Features
--------

[](#features)

- **Override Environment Variables**: Variables in `.env.local` will override those defined in `.env`.
- **Easy to Use**: Simply install the package and create a `.env.local` file.
- **Auto-Discovery**: The package uses Laravel's auto-discovery feature, so no additional setup is required.

---

Requirements
------------

[](#requirements)

- **PHP**: &gt;=7.3
- **Laravel**: &gt;=8.0
- **Dependencies**:
    - `vlucas/phpdotenv`: &gt;=5.5

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---

Additional Notes
================

[](#additional-notes)

- **Environment File Order**: The variables in `.env.local` will override those in `.env`. This allows you to keep default settings in `.env` and customize only the necessary variables in `.env.local`.
- **Version Control**: It's recommended to add `.env.local` to your `.gitignore` file to prevent sensitive data from being committed to your repository.
- **Configuration Caching**: If you cache your configurations using `php artisan config:cache`, remember to clear the cache whenever you make changes to your environment files.

    ```
    php artisan config:clear
    ```
- **Auto-Discovery**: This package supports Laravel's package auto-discovery, so you don't need to manually add the service provider to your `config/app.php` file.
- **To Add Manually**: Add following to your config/app.php file:

```
'providers' => [
    // Other Service Providers

    \LaravelEnvLocal\EnvLocalServiceProvider::class, // Add this line
],
```

---

Troubleshooting
===============

[](#troubleshooting)

- **Variables Not Overriding**: If the variables from `.env.local` are not overriding those from `.env`, ensure that:

    - The `.env.local` file is located in the root directory of your Laravel project.
    - You have cleared the configuration cache using `php artisan config:clear`.
    - There are no syntax errors in your `.env.local` file.
- **Cache Issues**: Remember that environment variables are cached when you run `php artisan config:cache`. Always clear the cache after making changes to your environment files.

---

Credits
=======

[](#credits)

- **Author**: Nahid Hossain
- **Website**:
- **GitHub**:

---

Support
=======

[](#support)

If you encounter any issues or have questions, feel free to open an issue on GitHub .

---

Versioning
==========

[](#versioning)

This project adheres to [Semantic Versioning](https://semver.org/). For the versions available, see the [tags on this repository](https://github.com/akmnahid/laravel-local-env-support/tags).

---

Changelog
=========

[](#changelog)

All notable changes to this project will be documented in this section.

- **v1.0.3**: Updated readme.md
- **v1.0.2**: Updates with new codebases
- **v1.0.1**: Initial release with support for loading `.env.local` files.
- **v1.0.0**: Initial release with support for loading `.env.local` files.

---

Feel free to customize and extend this package to suit your specific needs. Contributions and suggestions are welcome!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~134 days

Total

4

Last Release

589d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86813679886983f5d4965996b1e5676d29083a38ea1f512a416d9369e19ff5d8?d=identicon)[akmnahid](/maintainers/akmnahid)

---

Top Contributors

[![akmnahid](https://avatars.githubusercontent.com/u/4361347?v=4)](https://github.com/akmnahid "akmnahid (15 commits)")

---

Tags

akmnahidlaravel-env-local-support

### Embed Badge

![Health badge](/badges/akmnahid-laravel-local-env-support/health.svg)

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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