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 Laravel 4 Basics Getting Started with Laravel Laravel Folder Structure

My folder structure is different than what's on the video?

In the video, the Laravel folder structure covered by Hampton is completely different than what I have on my machine. I realize I probably have a newer version. Is there a way to go to an older version so I can better follow along with the lesson?

2 Answers

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Joseph,

You (and I!) are running Laravel 5.x, whereas Hampton is running 4.x in this video. I don't think it's worth degrading to an older version. That said, I'm going through the video now, and pausing it and digging around. Hopefully this course will be updated at some point but for now, here's a guide for you and anyone else who takes the course in the meantime:

Bootstrap

  • Hampton doesn't go into any of the files, and even though there are different ones in here now, the concept he describes is likely the same. And you don't need to edit any of these anyway.

Public

  • Same stuff in here, except that there's some CSS already in here (Edit: no longer the case with Laravel 5.1). Mostly normalize.css type stuff. IDK what the packages folder is in 4.x, but Hampton doesn't even mention it so, meh.

Vendor

  • Looks mostly the same, and there's nothing to mess with here anyway.

App

  • Several of the folders in App appear to have been moved out to the project root.
    • Config, storage and tests have received this treatment, for example
  • Controllers has been moved inside Http (within App)
  • Models ... I'm not sure if this ended up anywhere. The one file that was in it (User.php) is now just in the app folder. Likely, model files go in here, which makes sense to me.
  • Views is now out in the resources folder, and contains some new stuff
  • Routes.php is now in the Http folder within App

Hope that helps! One final note: if, going forward, you can't find a folder or file Hampton is working on, in Sublime Text you can go to Find -> Find in Files (or shift-command-f on a mac), and type the name of the folder/file. You will often get a path that's specified somewhere else (for example, I found where routes.php was by searching for it, and finding the line require app_path('Http/routes.php');).

Happy coding everyone!

Wow thank you for the great answer. Very helpful :)

Daniel Narvaez
Daniel Narvaez
16,319 Points

I was a little bit confused. Excelent description. Thank you.

Greg Kaleka
Greg Kaleka
39,021 Points

Glad it helped you both!

Stick with it - Laravel is awesome.

Jack McDowell
Jack McDowell
37,797 Points

Greg Kaleka I can't thank you enough for this write-up.

Stacey Fenton
Stacey Fenton
5,501 Points

Just what I needed, too - thank you!