1. Go to this page and download the library: Download lithemod/env 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/ */
lithemod / env example snippets
use Lithe\Support\Env;
// Load environment variables from the specified path
Env::load(__DIR__);
if (Env::has('MY_VARIABLE')) {
// The environment variable is defined
}
if (Env::has(['VAR_ONE', 'VAR_TWO'])) {
// At least one of the variables is defined
}
use Lithe\Support\Env;
// Load the .env file
Env::load(__DIR__);
// Get a variable
$dbHost = Env::get('DB_HOST', 'localhost');
echo "Database Host: " . $dbHost;
// Set a variable
Env::set('MY_VARIABLE', 'Hello, World!');
// Check if a variable exists
if (Env::has('MY_VARIABLE')) {
echo "MY_VARIABLE is set!";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.