Skip to content

Instantly share code, notes, and snippets.

@tobiasroeder
Created December 28, 2023 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobiasroeder/60c2369733b6339487272a67b176b4fc to your computer and use it in GitHub Desktop.
Save tobiasroeder/60c2369733b6339487272a67b176b4fc to your computer and use it in GitHub Desktop.
PHP Environment Variables
<IfModule mod_env.c>
SetEnv CONTEXT Development
</IfModule>
<?php
declare(strict_types=1);
define('CONTEXT_ENV', getenv('CONTEXT'));
define('CONTEXT_DEVELOPMENT', 'Development');
define('CONTEXT_PRODUCTION', 'Production');
function is_development(): bool
{
return CONTEXT_DEVELOPMENT === CONTEXT_ENV;
}
function is_production(): bool
{
return CONTEXT_PRODUCTION === CONTEXT_ENV;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment