Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pyncerrc/pyncer-dotenv

A phpdotenv implementation to read and write .env values from and to constants.
https://github.com/pyncerrc/pyncer-dotenv

dotenv php pyncer

Last synced: about 1 month ago
JSON representation

A phpdotenv implementation to read and write .env values from and to constants.

Awesome Lists containing this project

README

        

# Pyncer Dotenv
A [phpdotenv](https://github.com/vlucas/phpdotenv) implementation to read and write .env values from and to constants.

## Installation

Install via [Composer](https://getcomposer.org):

```bash
$ composer require pyncer/dotenv
```

## Example

```php
use Dotenv\Dotenv;
use Dotenv\Repository\RepositoryBuilder;
use Pyncer\Dotenv\ConstAdapter;

// ...

$repository = RepositoryBuilder::createWithNoAdapters()
->addAdapter(new ConstAdapter('Vendor\\Namespace'))
->immutable()
->make();

$dotenv = Dotenv::create($repository, getcwd());
$dotenv->load();

// ...

echo \Vendor\Namespace\MY_ENV_VARIABLE;
```