The laravel/lumen-framework package suggests installing vlucas/phpdotenv, but the vlucas/phpdotenv package is a hard dependency of the laravel/lumen-framework package. The helper env is autoloaded by composer, which depends on DotenvFactory, and there is no way to run the framework AFAIK without triggering a Class Not Found error.
Run the web server and visit localhost:8080 in your browser:
php -S localhost:8080
The result is the following:
Fatal error: Uncaught Error: Class 'Dotenv\Environment\DotenvFactory' not found in vendor/illuminate/support/helpers.php:646 Stack trace:
#0 /vendor/laravel/lumen-framework/src/Application.php(89): env('APP_TIMEZONE')
#1 index.php(18): Laravel\Lumen\Application->__construct('...')
#2 {main} thrown in vendor/illuminate/support/helpers.php on line 646
Solution
Make env not rely on vlucas/phpdotenv OR add vlucas/phpdotenv as a requirement for laravel/lumen-framework.
Description:
The
laravel/lumen-framework
package suggests installingvlucas/phpdotenv
, but thevlucas/phpdotenv
package is a hard dependency of thelaravel/lumen-framework
package. The helperenv
is autoloaded by composer, which depends onDotenvFactory
, and there is no way to run the framework AFAIK without triggering a Class Not Found error.Steps To Reproduce:
Require Lumen Framework:
Create the app:
Run the web server and visit
localhost:8080
in your browser:The result is the following:
Solution
Make
env
not rely onvlucas/phpdotenv
OR addvlucas/phpdotenv
as a requirement forlaravel/lumen-framework
.