October 10, 2024

Required .env vars

In the register or boot method of AppServiceProvider This will make sure the .env var is both present and not empty

$dotenv = Dotenv::createImmutable($this->app->environmentPath());  
$dotenv->required('TEST_ENV_VAR')->notEmpty();

© 2025 Terrence Eisenhower. All rights reserved.