PHP code example of peachpear / phpdotenv

1. Go to this page and download the library: Download peachpear/phpdotenv library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

peachpear / phpdotenv example snippets


define("APP_NAME", Dotenv\Dotenv::get("name"));

define("APP_DEBUG", Dotenv\Dotenv::get("app.debug"));
define("APP_TRACE", Dotenv\Dotenv::get("app.trace"));

$database_config = [
    "hostname" => Dotenv\Dotenv::get("database.hostname"),
    "database" => Dotenv\Dotenv::get("database.database"),
    "username" => Dotenv\Dotenv::get("database.username"),
    "password" => Dotenv\Dotenv::get("database.password"),
    "hostport" => Dotenv\Dotenv::get("database.hostport"),
];