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! While you're at it, check out some resources Treehouse students have shared here.

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

PHP

Tim Knight
Tim Knight
28,888 Points

Better 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.

  1. When Hampton did a var_dump the output had syntax coloring. How did he make that happen?
  2. 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?

Tim Knight
Tim Knight
28,888 Points

I'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.

1 Answer

Tim Knight
Tim Knight
28,888 Points

So I've been able to figure out both of these items and thought I'd note them for anyone who came across it.

  1. 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).
  2. 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 run php 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 command hostname 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
Tim Knight
28,888 Points

Another thing to mention is that Laravel uses https://filp.github.io/whoops/ as it's debug handler.