$host = $_SERVER['HTTP_HOST'] ?? ''; if (strpos($host, 'localhost') !== false) { putenv('APP_ENV=local'); } elseif (strpos($host, 'staging.') !== false) { putenv('APP_ENV=staging'); } else { putenv('APP_ENV=production'); } $app = require_once __DIR__.'/../bootstrap/app.php';