Directory structure changes in Laravel 5.3

(This is part of a series of posts on New Features in Laravel 5.3.)

  1. Introducing Laravel Echo: An In-Depth Walk-Through
  2. The new $loop variable in Laravel 5.3
  3. Customizing additional parameters in FirstOrCreate in Laravel 5.3
  4. The new cache() global helper in Laravel 5.3
  5. New JSON-column where() and update() syntax in Laravel 5.3
  6. Advanced operations with Collection::where in Laravel 5.3
  7. Image dimension validation rules in Laravel 5.3
  8. Customizing pagination templates in Laravel 5.3
  9. 5.3 feature announcement notes from Laracon
  10. Routing changes in Laravel 5.3
  11. Introducing Laravel Scout
  12. Introducing Laravel Passport
  13. Introducing Mailables in Laravel 5.3
  14. Directory structure changes in Laravel 5.3
  15. The new Notification system in Laravel 5.3
  16. Update to queue workers in Laravel 5.3
  17. Using Vue in Laravel 5.3, with the Vue bootstrap and sample component
  18. Defining console commands via closure in Laravel 5.3

We've already covered the new routes directory and the changes that will make to the directory structure. But there's one other directory change coming in Laravel 5.3: many of the default folders will not show up until you run a command that requires them.

These directories come in each new version of Laravel prior to 5.3 but are often not used, so all new installs won't have them. Here's the list of folders that are going away:

  • Events
  • Jobs
  • Listeners
  • Policies

Notice a pattern? These are directories that contain a single, more advanced class structure that aren't universal to Laravel apps. Events, Jobs, Listeners, and Policies.

One note: If you were used to manually creating classes for each of those structures, you may find this change adds an extra step; but if so, it's really worth considering using Artisan to create them anyway. Artisan will handle creating these directories if they don't exist, so the change should be transparent in that context.

For a great visual of how this change will simplify a default Laravel install, take a look at this graphic from Laravel News:

Laravel App Folder Changes

(image from Laravel News post Laravel 5.3 changes the 'app' folder)

There are also new folders that won't show up on a new install but might show up after you use Artisan generators: app/Mail for Mailables and app/Notifications for Notifications.

Comments? I'm @stauffermatt on Twitter

Tags: laravel | laravel 5.3

Matt Stauffer headshot

Hi, I'm Matt Stauffer.

I'm partner & technical director at Tighten Co.

You can find me on Twitter at @stauffermatt

Like what you're reading?

I wrote an entire 450+ page book for O'Reilly: Laravel: Up and Running.

You can order the eBook or print book today.