I ran into an issue this evening while working on a Laravel application. I was adding some mail functionality and set the MAIL_FROM_NAME environment variable to my name. Later, I got the following error message when I tried to load any page in my application:

Fatal error: Uncaught ReflectionException: Class config does not exist in /Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Container/Container.php:681 Stack trace: #0   /Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('config') #1   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('config') #2   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(702): Illuminate\Container\Container->make('config') #3   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(105): Illuminate\Foundation\Application->make('config') #4   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(263): app('config') #5   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(211): config('app.debug') #6   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Foun in   
/Users/joe/Code/clob/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681

Yuck. A quick Google didn't help, so I started reversing my steps. It ended up being something very simple. I had set the environment variable as follows:

MAIL_FROM_NAME=Joe Lennon

The application was choking on the space. If you're using environment variables with spaces in the values, you need to wrap the value in quotes, like the following:

MAIL_FROM_NAME="Joe Lennon"

As soon as I made that change, everything was working fine again. Hopefully this post will help save someone else some heartache.