PHPackages                             unleashedtech/dotenv-drupal - 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. unleashedtech/dotenv-drupal

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

unleashedtech/dotenv-drupal
===========================

0.3.1(3y ago)02.4k1[1 PRs](https://github.com/unleashedtech/dotenv-drupal/pulls)MITPHPPHP &gt;=7.4.0

Since Nov 29Pushed 3y ago8 watchersCompare

[ Source](https://github.com/unleashedtech/dotenv-drupal)[ Packagist](https://packagist.org/packages/unleashedtech/dotenv-drupal)[ RSS](/packages/unleashedtech-dotenv-drupal/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (1)Versions (27)Used By (0)

Environment-Based Drupal Settings
=================================

[](#environment-based-drupal-settings)

This package extends Symfony's [symfony/dotenv](https://symfony.com/components/Dotenv)component to allow streamlined Drupal config via [Environment Variables](https://en.wikipedia.org/wiki/Environment_variable). Please refer to the Symfony component's documentation about how `.env` files should be used. It is important to note that `.env` files are *ignored* if the `APP_ENV` var has already been set by the server. For performance purposes, production environments should ideally rely on pre-configured environment variables, rather than environment variable values loaded from `.env` files.

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

[](#installation)

`composer require unleashedtech/dotenv-drupal`

### Configuring Drupal

[](#configuring-drupal)

First, you'll need to configure Drupal to use this package.

#### Drupal Settings &amp; Sites Files

[](#drupal-settings--sites-files)

Drupal is typically configured via `settings.php` files in various directories. To use this package with Drupal, some code will need to be added to the top of the relevant `settings.php` file(s):

```
