Created
December 28, 2023 23:15
-
-
Save tobiasroeder/60c2369733b6339487272a67b176b4fc to your computer and use it in GitHub Desktop.
PHP Environment Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_env.c> | |
SetEnv CONTEXT Development | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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