Directory structure changes in Laravel 5.3
Posted on August 08, 2016
(This is part of a series of posts on New Features in Laravel 5.3. )
- Introducing Laravel Echo: An In-Depth Walk-Through
- The new $loop variable in Laravel 5.3
- Customizing additional parameters in FirstOrCreate in Laravel 5.3
- The new cache() global helper in Laravel 5.3
- New JSON-column where() and update() syntax in Laravel 5.3
- Advanced operations with Collection::where in Laravel 5.3
- Image dimension validation rules in Laravel 5.3
- Customizing pagination templates in Laravel 5.3
- 5.3 feature announcement notes from Laracon
- Routing changes in Laravel 5.3
- Introducing Laravel Scout
- Introducing Laravel Passport
- Introducing Mailables in Laravel 5.3
- Directory structure changes in Laravel 5.3
- The new Notification system in Laravel 5.3
- Update to queue workers in Laravel 5.3
- Using Vue in Laravel 5.3, with the Vue bootstrap and sample component
- Defining console commands via closure in Laravel 5.3
Warning: This post is over a year old. I don't always update old posts with new information, so some of this information may be out of date.
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:
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:
(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