PHPackages                             phossa2/env - 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. phossa2/env

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

phossa2/env
===========

Library to load environments from a shell style file.

2.0.6(10y ago)2125[1 PRs](https://github.com/phossa2/env/pulls)MITPHP &gt;=5.4.0

Since Jun 21Compare

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

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

phossa2/env \[ABANDONED\]
=========================

[](#phossa2env-abandoned)

**PLEASE USE [phoole/env](https://github.com/phoole/env) library instead**

[![Build Status](https://camo.githubusercontent.com/1f789929ce6facfec1ea8777357dcc6a61f89e9195d8651180be6ad1582374ce/68747470733a2f2f7472617669732d63692e6f72672f70686f737361322f656e762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/phossa2/env)[![Code Quality](https://camo.githubusercontent.com/c17cb3ddfbd23c677a3b15641421772aae2f9e01da5a6446def8d21fdeb3f5e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70686f737361322f656e762f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://travis-ci.org/phossa2/env)[![Code Climate](https://camo.githubusercontent.com/c3682ef9d36c24fc6d22db98e80b1e25bc3caaeb22d19128b0f2138f2971c7d4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f70686f737361322f656e762f6261646765732f6770612e737667)](https://codeclimate.com/github/phossa2/env)[![PHP 7 ready](https://camo.githubusercontent.com/f5654d4da894a25cae4829cfbe271c6c1dd4368ed49e5677eb456e91042e0b3f/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f70686f737361322f656e762f6d61737465722f62616467652e737667)](https://travis-ci.org/phossa2/env)[![HHVM](https://camo.githubusercontent.com/9bfcd568850f1ba3899d49c295fd485206cba8877c019178e644793145f413d8/68747470733a2f2f696d672e736869656c64732e696f2f6868766d2f70686f737361322f656e762e7376673f7374796c653d666c6174)](http://hhvm.h4cc.de/package/phossa2/env)[![Latest Stable Version](https://camo.githubusercontent.com/b2b3e763a30a612bdf8d7245d54f8f585c8901771bd3ed3dd7a13feac417dc1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f70686f737361322f656e762e7376673f7374796c653d666c6174)](https://packagist.org/packages/phossa2/env)[![License](https://camo.githubusercontent.com/4fc6538ded72843e26a272d300ce4c95da083ce92576e10e4fdd505d579a8125/68747470733a2f2f696d672e736869656c64732e696f2f3a6c6963656e73652d6d69742d626c75652e737667)](http://mit-license.org/)

**phossa2/env** is a library to load environment variables from fully bash shell compatible files.

It requires PHP 5.4, supports PHP 7.0+ and HHVM. It is compliant with [PSR-1](http://www.php-fig.org/psr/psr-1/ "PSR-1: Basic Coding Standard"), [PSR-2](http://www.php-fig.org/psr/psr-2/ "PSR-2: Coding Style Guide"), [PSR-4](http://www.php-fig.org/psr/psr-4/ "PSR-4: Autoloader").

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

[](#installation)

Install via the `composer` utility.

```
composer require "phossa2/env=2.*"

```

or add the following lines to your `composer.json`

```
{
    "require": {
       "phossa2/env": "2.*"
    }
}
```

Usage
-----

[](#usage)

- Put your environments in file `.env`,

    ```
    # this is comment line
    BASE_DIR='/home/web'

    # reference here
    APP_DIR=${BASE_DIR}/app   # another comment here
    ```
- Load and use your env variables in PHP script

    ```
