PHPackages                             allysonsilva/laravel-multienv - 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. allysonsilva/laravel-multienv

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

allysonsilva/laravel-multienv
=============================

This package allows you to use multiple .envs in multitenant environment

v2.1.0(3y ago)537.2k3[1 issues](https://github.com/allysonsilva/laravel-multienv/issues)MITPHPPHP &gt;=8.0

Since Apr 13Pushed 3y ago3 watchersCompare

[ Source](https://github.com/allysonsilva/laravel-multienv)[ Packagist](https://packagist.org/packages/allysonsilva/laravel-multienv)[ Docs](https://github.com/allysonsilva/laravel-multienv)[ RSS](/packages/allysonsilva-laravel-multienv/feed)WikiDiscussions 2.x Synced 2d ago

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

Laravel Multi ENVs
==================

[](#laravel-multi-envs)

 [![Social Card of Laravel Multi ENVs](/images/art/socialcard.png)](/images/art/socialcard.png)

[![PHP Version](https://camo.githubusercontent.com/b8af1bc5f088f10f603d6291d56e8e2049b81f117f352efa14c1b87bd725c75c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c6c79736f6e73696c76612f6c61726176656c2d6d756c7469656e763f636f6c6f723d253233344635423933266c6f676f3d706870)](https://www.php.net)[![Laravel Version](https://camo.githubusercontent.com/4e55c6d6cca644ed9cd390b02fa876085b2eaed01fe8b17ec6865a5ca18ef1d1/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d6c61726176656c266d6573736167653d254532253839254135392e3026636f6c6f723d666632643230266c6f676f3d6c61726176656c)](https://laravel.com)[![CI Status](https://github.com/allysonsilva/laravel-multienv/actions/workflows/ci.yml/badge.svg)](https://github.com/allysonsilva/laravel-multienv/actions/workflows/ci.yml)[![PHPCS - GitHub Workflow Status](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpcs.yml/badge.svg)](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpcs.yml)[![PHPMD - GitHub Workflow Status](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpmd.yml/badge.svg)](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpmd.yml)[![PHPStan - GitHub Workflow Status](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpstan.yml/badge.svg)](https://github.com/allysonsilva/laravel-multienv/actions/workflows/phpstan.yml)[![Coverage Status](https://camo.githubusercontent.com/b569c8e8cf2e7a724037ccd42d1e432b780e24e1215f2d4c0823ce987c4171bf/68747470733a2f2f636f6465636f762e696f2f67682f616c6c79736f6e73696c76612f6c61726176656c2d6d756c7469656e762f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d483534364f4b4f445142)](https://codecov.io/gh/allysonsilva/laravel-multienv)[![Latest Version](https://camo.githubusercontent.com/fcbef51c1224072c6399dcade2d34af0506e239c0f1f38e6911cfd8f76664426/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6c79736f6e73696c76612f6c61726176656c2d6d756c7469656e762e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/allysonsilva/laravel-multienv)[![MIT Licensed](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE.md)

> Use **multiple** `.envs` files and have a chain of precedence for the environment variables in these different `.envs` files. Use the `.env` file in a custom way to manipulate environment variables by domain (*multi-tenant*).

🚀 Installation
--------------

[](#--installation)

### Requirements

[](#requirements)

The package has been developed and tested to work with the following minimum requirements:

- *PHP 8.0*
- *Laravel 9.0*

### Laravel version Compatibility

[](#laravel-version-compatibility)

LaravelPHPPackage9.x8.0**^2.0**8.x7.4**^1.0**### Install the Package

[](#install-the-package)

You can install the package via Composer:

```
composer require allysonsilva/laravel-multienv
```

### Publish the Config

[](#publish-the-config)

You can then publish the package's config file by using the following command:

```
php artisan vendor:publish --tag="envs-config"
```

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

[](#--configuration)

1. Add trait to **kernel console** `app/Console/Kernel.php`:

    ```
