PHP code example of josegarcia / nexus

1. Go to this page and download the library: Download josegarcia/nexus 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/ */

    

josegarcia / nexus example snippets


use Garcia\Nexus;

$filePath = __DIR__ . '/.env.test'; // Assuming .env is present for testing purposes

// Create a temporary .env file for testing
file_put_contents($filePath, "TEST_VAR=123\nANOTHER_VAR=abc");

// Load the .env file
Nexus::load($filePath);

// Check if environment variables are set
echo getenv('TEST_VAR') . "\n";
echo $_ENV['ANOTHER_VAR'] . "\n";
echo $GLOBALS['TEST_VAR'] . "\n";
echo getenv('ANOTHER_VAR') . "\n";