Skip to content

muriloperosa/php-dot-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP DotEnv Loader

Latest Stable Version Total Downloads License PHP Version Require

Simple library to load and get values from .env file(s).

Install

composer require murilo-perosa/dot-env

How to Use

Namespace

use MuriloPerosa\DotEnv\DotEnv;

Load File

// enter path to .env file
(new DotEnv(__DIR__ . '/../.env'))->load();

Get Values

// php implementation
$value = getenv('YOUR_KEY');

// package implementation
$value = DotEnv::get('YOUR_KEY');

// package implementation with default value
$value = DotEnv::get('YOUR_KEY', 'DEFAULT_VALUE');