PHPackages                             srdorado/php-dotenv - 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. [DevOps &amp; Deployment](/categories/devops)
4. /
5. srdorado/php-dotenv

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

srdorado/php-dotenv
===================

Loads environment variables from .env file to getenv(), $\_ENV and $\_SERVER

1.0.0(3y ago)011MITPHPPHP &gt;=5.4

Since Feb 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/srdorado/php-dotenv)[ Packagist](https://packagist.org/packages/srdorado/php-dotenv)[ Docs](https://github.com/srdorado/php-dotenv)[ RSS](/packages/srdorado-php-dotenv/feed)WikiDiscussions main Synced 1mo ago

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

ENV: php-dotenv
===============

[](#env-php-dotenv)

*By [srdorado](https://github.com/srdorado)*

*Base code [devcoder-xyz](https://github.com/devcoder-xyz)*

Loads environment variables from .env file to getenv(), $\_ENV and $\_SERVER.
=============================================================================

[](#loads-environment-variables-from-env-file-to-getenv-_env-and-_server)

[![License](https://camo.githubusercontent.com/245109fe85988e44f1263760184cbd68821edded983f918f19ced259b86b81a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7372646f7261646f2f736969676f2d636c69656e742d706870)](https://packagist.org/packages/srdorado/php-dotenv)[![Packagist PHP Version Support](https://camo.githubusercontent.com/4e71b2b9230c085bb3802ab91073c3440e9eb2a9a57a626fb944ecb75ebfb264/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7372646f7261646f2f7068702d646f74656e76)](https://camo.githubusercontent.com/4e71b2b9230c085bb3802ab91073c3440e9eb2a9a57a626fb944ecb75ebfb264/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7372646f7261646f2f7068702d646f74656e76)[![Packagist Version](https://camo.githubusercontent.com/6d4b736c48bbf13cbf021d5fbb7c47ca11cfa80de92125c159c9df7ead036d4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7372646f7261646f2f7068702d646f74656e76)](https://packagist.org/packages/srdorado/php-dotenv)[![Packagist Downloads](https://camo.githubusercontent.com/cdc616c4dbce803492bb543a844e56daf89de11ed0e79d8e6bca0a962b2bbd19/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7372646f7261646f2f7068702d646f74656e76)](https://packagist.org/packages/srdorado/php-dotenv)[![Composer dependencies](https://camo.githubusercontent.com/aae95fbaa83bc6a3f4597f3a75da45ea46ec236fc324617f0e5a2f15e07fe750/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e64656e636965732d302d627269676874677265656e)](https://github.com/srdorado/php-dotenv/blob/master/composer.json)[![Test workflow](https://camo.githubusercontent.com/ee08db0d49196f044ec5b43b3ea8034c9ab2901c956919da90b0cc1964657b8e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7372646f7261646f2f7068702d646f74656e762f746573743f6c6162656c3d74657374266c6f676f3d676974687562)](https://github.com/srdorado/php-dotenv/actions?workflow=test)[![Codecov](https://camo.githubusercontent.com/60a8c2e9f7bd86a2734ba726f75bc71eb98b0cff77e645159604958b55d09555/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7372646f7261646f2f7068702d646f74656e763f6c6f676f3d636f6465636f76)](https://codecov.io/gh/srdorado/php-dotenv)[![composer.lock](https://camo.githubusercontent.com/17e219275db3024066b35dfc98913c9434b5f6c6ed66bb9d7997cbce21f361a1/68747470733a2f2f706f7365722e707567782e6f72672f7372646f7261646f2f7068702d646f74656e762f636f6d706f7365726c6f636b)](https://packagist.org/packages/srdorado/php-dotenv)

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

[](#installation)

Use [Composer](https://getcomposer.org/)

### Composer Require

[](#composer-require)

```
composer require srdorado/php-dotenv

```

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

[](#requirements)

- PHP version &gt;= 5.4

**How to use ?**

```
APP_ENV=dev
DATABASE_DNS=mysql:host=localhost;dbname=test;
DATABASE_USER="root"
DATABASE_PASSWORD=root
MODULE_ENABLED=true
NUMBER_LITERAL=0
NULL_VALUE=null

```

Load the variables
------------------

[](#load-the-variables)

```
