If you want a boundary between you and your runtime environment, this library can help. If you like to use .env files this library can help.
composer require remotelyliving/php-env
<?php
// needs to be set before hand through docker or could grab the app environment from cli args
// EnvironmentType is an enum that you can extend to add more values to
$envType = new EnvironmentType(getenv('ENVIRONMENT'));
$envFile = "/my/app/envs/.{$envType}.env";
// we can now create the app environment
$env = Environment::createWithEnvFile($envType, $envFile);
// tells you which environment you're in
$env->is(EnvironmentType::DEVELOPMENT()); // true
$env->is(EnvironmentType::PRODUCTION()); // false
// tells you if a var exists
$env->has('FOO'); // true
// returns a value caster of a value that can then be called to get stricter types
$env->get('FOO')->asArray();
$env->get('BAR')->asBoolean();
$env->get('BAR')->asInteger();