src/Viserio/Component/Foundation/Bootstrap/LoadEnvironmentVariables.php
public static function bootstrap(KernelContract $kernel): void
    {
        if (\file_exists($kernel->getStoragePath('config.cache.php'))) {
            return;
        }

        $env = Env::get('APP_ENV');

        if ($env === null && ! class_exists(Dotenv::class)) {
            $message = '[APP_ENV] environment variable is not defined. ';
            $message .= 'You need to define environment variables for configuration or run [composer require vlucas/phpdotenv] as a Composer dependency to load variables from a .env file.';

            throw new \RuntimeException($message);
        }

        if (! class_exists(Dotenv::class)) {
            $kernel->detectEnvironment(static function () use ($env) {
                return $env ?? 'prod';
            });

            return;
        }

        static::checkForSpecificEnvironmentFile($kernel, $env);

        try {
            (new Dotenv($kernel->getEnvironmentPath(), $kernel->getEnvironmentFile()))->load();

            $kernel->detectEnvironment(static function () use ($env) {
                return $env ?? Env::get('APP_ENV', 'prod');
            });
        } catch (InvalidPathException $exception) {
        } catch (InvalidFileException $exception) {
            Dumper::dump($exception->getMessage());

            die(1);
        }
    }
public static function bootstrap(KernelContract $kernel): void
    {
        if (\file_exists($kernel->getStoragePath('config.cache.php'))) {
            return;
        }

        $env = Env::get('APP_ENV');

        if ($env === null && ! class_exists(Dotenv::class)) {
            $message = '[APP_ENV] environment variable is not defined. ';
            $message .= 'You need to define environment variables for configuration or run [composer require vlucas/phpdotenv] as a Composer dependency to load variables from a .env file.';

            throw new \RuntimeException($message);
        }

        if (! class_exists(Dotenv::class)) {
            $kernel->detectEnvironment(static function () use ($env) {
                return $env ?? 'prod';
            });

            return;
        }

        static::checkForSpecificEnvironmentFile($kernel, $env);

        try {
            (new Dotenv($kernel->getEnvironmentPath(), $kernel->getEnvironmentFile()))->load();

            $kernel->detectEnvironment(static function () use ($env) {
                return $env ?? Env::get('APP_ENV', 'prod');
            });
        } catch (InvalidPathException $exception) {
        } catch (InvalidFileException $exception) {
            Dumper::dump($exception->getMessage());

            die(1);
        }
    }
{@inheritdoc}