PHPackages                             pawelabrams/minenv - 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. pawelabrams/minenv

ActiveLibrary

pawelabrams/minenv
==================

Makes environment variables from .env files accessible to PHP. A lightweight alternative to phpdotenv.

0.2.x-dev(6y ago)02BSD-3-ClausePHPPHP ^5.6 || ^7.0

Since Feb 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/pawelabrams/minenv)[ Packagist](https://packagist.org/packages/pawelabrams/minenv)[ Docs](https://github.com/pawelabrams/minenv)[ RSS](/packages/pawelabrams-minenv/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (2)Used By (0)

minenv
======

[](#minenv)

Feeds `getenv()`, `$_ENV` and `$_SERVER` with `.env` file's contents. One procedure, no bullshit.

An incomplete rewrite of [PHP dotenv](https://github.com/vlucas/phpdotenv).

Purpose
-------

[](#purpose)

**[You should never commit your production keys to a public repo.](http://www.securityweek.com/github-search-makes-easy-discovery-encryption-keys-passwords-source-code)** [Never.](http://blog.nortal.com/mining-passwords-github-repositories/) [Ever.](http://evandrix.svbtle.com/how-i-gained-access-to-amazon-ec2-servers-from-github-search-adapted) You can publish developer settings, sure -- if you know your setup is safe and unavailable to access from outside. But for most people, configuration contains sensitive data like keys to external APIs, live database credentials and other details that the public shall not see.

Ignored config files are good, but setting the sensitive data directly in the environment is better on the production servers. And to imitate the behaviour in the development? Just use minenv.

Usage
-----

[](#usage)

List the variables in `.env` file in a convenient location, away from users

```
SECRET_KEY=314b0r47353cr37k3y
APP_DSN="mysql:host=localhost;dbname=yourdb;charset=utf8"
APP_USER=yourname
APP_PASS=w3zn13pr0bujh4k0w4c

```

To use the variables, require the `minenv.php` and `loadenv()`.

```
