-
February 08, 2024
DIVE INTO THE STREAMLINED DIRECTORY STRUCTURE IN LARAVEL 11
If you want to follow along and experiment, you can create a Laravel 10 and Laravel 11 project side by side. We used the following commands to do so:
# Update the installercomposer global update laravel/installer -Wcd path/to/projects# Create a Laravel 10 applaravel new laravel-10-app -n --git --pest# Crate a Laravel 11 applaravel new laravel-11-app --dev -n --git --pestOn the surface, the project directory structure looks identical:

However, if you start diving into the subdirectories, the file count has dropped from a fresh Laravel 11 installation by ~ 69 files:
# Fresh Laravel v10 app$ find . -type f -not -path "./vendor/*" | wc -l=> 217# Fresh Laravel v11 app (as of 01/29/2024)$ find . -type f -not -path "./vendor/*" | wc -l=> 148Let's review the most significant updates and see how they compare to a Laravel 10 application so you can be ready for the changes coming to fresh Laravel 11 apps.
The
appDirectoryThe
appdirectory has been slimmed down tremendously, moving the nine middleware that ships with Laravel into the framework and out of the project. Typically, these middleware are not heavily customized, and Laravel 11 will provide other methods to customize built-in middleware and add your own middleware.
The appdirectory in a fresh Laravel 11 appMiddleware changes are done through the
bootstrap/app.phpfile, which is, according to Taylor Otwell, a “lean routes-esque style file for configuring Laravel” that looks like the following:return Application::configure(basePath: dirname(__DIR__))->withProviders()->withRouting(web: __DIR__.'/../routes/web.php',// api: __DIR__.'/../routes/api.php',commands: __DIR__.'/../routes/console.php',// channels: __DIR__.'/../routes/channels.php',health: '/up',)->withMiddleware(function (Middleware $middleware) {//})->withExceptions(function (Exceptions $exceptions) {//})->create();You could add an application middleware by adding something like the following in the
withMiddeware()closure:$middleware->web(append: \App\Http\Middleware\ExampleMiddleware::class);The
Kernel.phpfiles are no longer in the Laravel project, and these are handled through the frameworkbootstrap/app.phpfile.You might have also noticed that the
Controllersdirectory only includes oneControllerclass that doesn’t extend from anything. It’s up to you how you’d like to extend your controllers (or not), but it provides a defaultabstract Controllerclass.The
configDirectoryThe biggest shock for you might be the updated
configdirectory, which has…nothing inside of it (other than the.gitkeepfile). You will, however, notice that many more configuration options exist in the.env.examplefile.
If you want to publish any given configuration file from the framework to customize it, you can do so via the
config:publishcommand:# config/database.phpphp artisan config:publish database# config/logging.phpphp artisan config:publish logging# Or publish all of themphp artisan config:publishYou are free to only extend the configuration values you care about, and they will be merged with the framework’s defaults so you don’t have to keep all published configuration options in a given file.
Suppose you want to look up configuration values in the framework-shipped configuration. In that case, you can use the Artisan
config:showcommand, publish the config, or look it up in theconfig/logging.phpfile within the Laravel vendor folder:php artisan config:show loggingcat vendor/laravel/framework/config/logging.phpThe
databaseDirectoryThe
databasedirectory is roughly the same. However, you’ll notice that the migration filenames are prefixed in a way that does not represent a given date but keeps them in order as needed. Thecreate_personal_access_tokens.phpmigration file is no longer in the project. Personal access tokens are only required if you build an API, which we will cover in theroutesdirectory changes.
Also, the
database.sqlitefile will be installed by default unless you pick a different database option when creating a new Laravel project.The
routesDirectoryThe routes directory was also slimmed down only to include the
web.phpand theconsole.phproutes files. If you want to create an API or use the broadcasting functionality, you can install them viaartisan:php artisan install:apiphp artisan install:broadcastingThose commands will bring in the required migrations, JavaScript, and configuration files. What’s nice about this is that applications that don’t need broadcasting or API routes don’t have to worry about these unnecessary files being in the project.
Laravel 11 routesdirectoryThe
testDirectoryThe
test/directory no longer includes theCreatesApplicationtrait in Laravel 11 projects. If you upgrade your Laravel 10 project, you can remove this trait, as it’s now provided as part of the baseTestCasefrom the framework.
In a Laravel 10 project, the only thing included in the base
TestCaseclass in Laravel 10 is theCreatesApplicationtrait, which bootstraps the application when creating a fresh application as part of the setup before each test. You can safely remove this trait (and its usage) once you upgrade existing apps to Laravel 11.From Laravel 10 to Laravel 11
You don't have to change your Laravel 10 application's structure at all to upgrade to Laravel 11. This will only be the structure for brand new applications and you'll still be able to use the old way if you prefer.
- 3 comments
- By Admin
Comments
Anonymous
zs7zkj
Anonymous
zs7zkj
Anonymous
pq02083f4579e08a612425c0c1a17ee47add783b94pq
Anonymous
Woah! I'm really loving the template/theme of this blog. It's simple, yet effective. A lot of times it's tough to get that "perfect balance" between user friendliness and visual appearance. I must sayy that you've done a excellent job with this. In addition, the blog loads supoer fast for me on Firefox. Superb Blog! https://Accountportal.org/
Anonymous
wx10cz
Anonymous
Woah! I'm really loving the template/theme of this blog. It's simple, yet effective. A lot of times it's tough to get that "perfect balance" between user friendliness and visual appearance. I must sayy that you've done a excellent job with this. In addition, the blog loads supoer fast for me on Firefox. Superb Blog! https://Accountportal.org/
Anonymous
xtj5bg
Anonymous
xtj5bg
Anonymous
Woah! I'm really loving the template/theme of this blog. It's simple, yet effective. A lot of times it's tough to get that "perfect balance" between user friendliness and visual appearance. I must sayy that you've done a excellent job with this. In addition, the blog loads supoer fast for me on Firefox. Superb Blog! https://Accountportal.org/
Anonymous
x5h5gj
Anonymous
x5h5gj
Anonymous
Woah! I'm really loving the template/theme of this blog. It's simple, yet effective. A lot of times it's tough to get that "perfect balance" between user friendliness and visual appearance. I must sayy that you've done a excellent job with this. In addition, the blog loads supoer fast for me on Firefox. Superb Blog! https://Accountportal.org/
Anonymous
6nmd44
Anonymous
6nmd44
Anonymous
Excellent article. Keep writing such kind of info on your page. Im really impressed by your blog. Hi there, You've performed an incredible job. I will certainly digg it and personally suggest to my friends. I'm confident they'll be benefited from this site. http://gotanproject.net/node/24239250?------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22title%22%0D%0A%0D%0A%C3%89quipement%20de%20Boulangerie%20%C3%A0%20Qu%C3%A9bec%20:%20Guide%20Complet%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22body%22%0D%0A%0D%0APour%20les%20boulangeries%20%C3%A0%20Qu%C3%A9bec,%20l'%C3%A9quipement%20joue%20une%20t%C3%A2che%20essentiel%20dans%20la%20r%C3%A9ussite%20de%20l'entreprise.%20Que%20vous%20aussi%20soyez%20un%20tout%20%C3%A7a%20nouveau%20boulanger%20d%C3%A9sireux%20de%20d%C3%A9marrer%20votre%20propre%20%C3%A9tablissement%20ou%20un%20boulanger%20exp%C3%A9riment%C3%A9%20cherchant%20%C3%A0%20mettre%20%C3%A0%20niveau%20vos%20%C3%A9quipements,%20d%C3%A9cider%20de%20le%20bon%20outils%20pourrait%20faire%20toute%20la%20distinction%20dans%20la%20qualit%C3%A9%20de%20vos%20produits%20et%20dans%20l'effectivit%C3%A9%20hors%20de%20votre%20production.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cspan%20style=%22text-decoration:%20underline;%22%3EL'Importance%20de%20l'%C3%89quipement%3C/span%3E%20de%20Boulangerie%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AL'%C3%A9quipement%20de%20boulangerie%20ne%20se%20limite%20pas%20aux%20simples%20instruments%20utilis%C3%A9s%20par%20p%C3%A9trir%20et%20cuire%20le%20pain.%20Il%20englobe%20une%20vari%C3%A9t%C3%A9%20d'unit%C3%A9s%20et%20de%20machines%20con%C3%A7us%20par%20faciliter%20chaque%20%C3%A9tape%20du%20cours%20de%20de%20production%20du%20pain,%20des%20croissants%20croustillants%20aux%20baguettes%20moelleuses.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cem%3ELes%20Besoins%20Sp%C3%A9cifiques%20de%3C/em%3E%20Votre%20Boulangerie%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AAvant%20d'mettre%20de%20fric%20dans%20un%20%C3%A9quipement,%20%20%3Ca%20href=%22https://www.Equipements-boulangerie.com/%22%3Eboulangerie%20Boisbriand%3C/a%3E%20il%20est%20essentiel%20d'juger%20vos%20besoins%20sp%C3%A9cifiques.%20Cela%20sait%20l'%C3%A9chelle%20hors%20de%20votre%20boulangerie,%20le%20genre%20de%20produits%20que%20vous%20aussi%20pr%C3%A9voyez%20de%20fabriquer%20et%20le%20volume%20de%20production%20que%20vous%20aussi%20anticipez.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AChoisir%20le%20Bon%20%C3%89quipement%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AUne%20occasions%20que%20vous%20avez%20identifi%C3%A9%20vos%20besoins,%20vous%20aussi%20pouvez%20commencer%20%C3%A0%20rechercher%20le%20bon%20%C3%A9quipement.%20Les%20%C3%A9l%C3%A9ments%20n%C3%A9cessit%C3%A9s%20incluent%20les%20fours%20%C3%A0%20pain,%20les%20p%C3%A9trins,%20les%20laminoirs,%20les%20armoires%20de%20fermentation%20et%20efficacement%20d'autres%20encore.%20Il%20est%20essentiel%20de%20d%C3%A9cider%20de%20des%20%C3%A9quipements%20de%20haute%20qualit%C3%A9%20qui%20r%C3%A9pondent%20%C3%A0%20vos%20n%C3%A9cessit%C3%A9s%20de%20fabrication%20tout%20%C3%A7a%20en%20respectant%20votre%20finances.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AQualit%C3%A9%20et%20Fiabilit%C3%A9%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AInvestir%20droit%20dans%20un%20outils%20de%20boulangerie%20de%20haute%20qualit%C3%A9%20est%20important%20par%20assurer%20la%20fiabilit%C3%A9%20et%20la%20robustesse%20%C3%A0%20long%20terme.%20Des%20%C3%A9quipements%20de%20haute%20qualit%C3%A9%20peuvent%20non%20uniquement%20am%C3%A9liorer%20la%20norme%20de%20vos%20produits,%20mais%20en%20plus%20%C3%A9tendre%20votre%20productivit%C3%A9%20et%20r%C3%A9duire%20les%20co%C3%BBts%20de%20maintenance%20%C3%A0%20long%20terme.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cspan%20style=%22font-weight:%20bold;%22%3ETrouver%20le%20Bon%20Fournisseur%3C/span%3E%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cspan%20style=%22font-style:%20oblique;%22%3ETrouver%20un%20fournisseur%20de%20kit%3C/span%3E%20%3Cstrong%3Efiable%20et%20comp%C3%A9tent%20est%20tout%3C/strong%3E%20aussi%20essentiel%20que%20choisir%20les%20bons%20%C3%A9quipements.%20Recherchez%20des%20fournisseurs%20r%C3%A9put%C3%A9s%20qui%20fournissent%20un%20service%20apr%C3%A8s-vente%20fiable%20et%20un%20support%20approche%20pour%20vous%20assurer%20que%20votre%20outils%20fonctionne%20tout%20le%20temps%20de%20mani%C3%A8re%20optimale.%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0A%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AConclusion%3Cbr%3E%0D%0A%3Cbr%3E%0D%0A%0D%0AEn%20conclusion,%20l'%C3%A9quipement%20de%20%3Ca%20href=%22https://www.equipements-Boulangerie.com/%22%3EBoulangerie%20Boisbriand%3C/a%3E%20ex%C3%A9cute%20un%20r%C3%B4le%20important%20dans%20le%20succ%C3%A8s%20de%20votre%20petite%20entreprise.%20En%20choisissant%20rigoureux%20vos%20%C3%A9quipements,%20en%20privil%C3%A9giant%20la%20qualit%C3%A9%20et%20en%20travaillant%20avec%20des%20fournisseurs%20fiables,%20vous%20aussi%20pouvez%20cr%C3%A9er%20une%20boulangerie%20%C3%A0%20Qu%C3%A9bec%20%20prosp%C3%A8re%20et%20renomm%C3%A9e%20par%20la%20qualit%C3%A9%20de%20ses%20produits.%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22field_pays[value]%22%0D%0A%0D%0ASt%20Kitts%20&%20Nevis%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22changed%22%0D%0A%0D%0A%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22form_build_id%22%0D%0A%0D%0Aform-61aa2de511b1744181338558c2bc43fb%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22form_id%22%0D%0A%0D%0Alivredor_node_form%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22field_ville[0][value]%22%0D%0A%0D%0ABrandenburg%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22field_email[0][email]%22%0D%0A%0D%0A%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP%0D%0AContent-Disposition:%20form-data;%20name=%22op%22%0D%0A%0D%0AEnregistrer%0D%0A------WebKitFormBoundaryh3pokm4bskoZF4eP--
Anonymous
wnowwp
Anonymous
wnowwp