Created
July 18, 2017 18:43
-
-
Save Stormix/373496a07eef7e11810e95ab2e7dd652 to your computer and use it in GitHub Desktop.
A .env example for the php library PHP dotenv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// .env example | |
DATABASE_NAME="" | |
DATABASE_USER="" | |
DATABASE_PASS="" | |
SECRET_KEY="souper_seekret_key" | |
// Example.php You project file | |
<?php | |
require 'vendor/autoload.php'; | |
$dotenv = new Dotenv\Dotenv(__DIR__); | |
$dotenv->load(); | |
// Accessing the .env file variables | |
$dbname = getenv('DATABASE_NAME'); | |
$dbname = $_ENV['DATABASE_NAME']; | |
$dbname = $_SERVER['DATABASE_NAME']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment