PHP code example of monolyth / envy
1. Go to this page and download the library: Download monolyth/envy 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/ */
monolyth / envy example snippets
use Monolyth\Envy\Environment;
$environment = new Environment(__DIR__, [
'prod' => $_SERVER['SERVER_NAME'] == 'example.com',
'dev' => $_SERVER['SERVER_NAME'] == 'local.example.dev',
]);
if ($environment->prod) {
if (!$environment->cli) {
// ... logic ...
}
} elseif ($environment->dev) {
throw new Exception('something went wrong!');
}
var_dump($environment->foo); // string "bar"