Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Tim Knight
28,888 PointsBetter debugging and dumping in Laravel
Within the video for "Further Into Routing" in the "Laravel Basics" course there are two things that caught my eye.
- When Hampton did a var_dump the output had syntax coloring. How did he make that happen?
- When he accessed /hello/hampton before writing the route for it his debug screen was incredibly helpful. I don't have this information showing for me. I just have a "whoops" screen that shows.
One thing to note is that I'm not using Vagrant and Homestead. I have composer and MySQL installed through homebrew and everything is installed on my actual machine.
Are there ways I can turn on these features Hampton is using?
1 Answer

Tim Knight
28,888 PointsSo I've been able to figure out both of these items and thought I'd note them for anyone who came across it.
- As I mentioned in my comment on this one, if you want to install this you just need to use xdebug. If you're using homebrew like I am, use
brew install php55-xdebug
(or whichever version of PHP you're using). - This one all comes down to Laravel's current environment setting. Since I installed Laravel manually and am not using homestead the default environment for the application is production. If you go into
/app/config/local/app.php
you'll notice that there is an attribute for debug being set to true. From within your terminal runphp artisan env
in your project folder to make sure it's coming back with "local". If not open up your/bootstrap/start.php
file and find the detectEnvironment method. You'll want to change'local' => array('homestead')
to instead say your host name. You can use the terminal commandhostname
to determine what this is. See http://laravel.com/docs/configuration#environment-configuration for more details.
I hope that helps other people as well.

Tim Knight
28,888 PointsAnother thing to mention is that Laravel uses https://filp.github.io/whoops/ as it's debug handler.
Tim Knight
28,888 PointsTim Knight
28,888 PointsI've discovered that the var_dump syntax coloring likely comes from using xdebug. I installed this using homebrew with
brew install php55-xdebug
and it looks great. Still looking for details on the second item.