Folder Structure — Laravel 10 Discovery Training

In this new chapter I suggest you discover together how to install Laravel and we will see the folder structure. A little reminder before you start, if you ever need information on the framework and how it works, don’t hesitate to go to the documentation. Unfortunately, it is only available in English, but it is relatively complete and fairly easy to understand.


There are different ways to install Laravel but the easiest approach is to rely on Composer with the create-project command.

composer create-project laravel/laravel=10 MonApp

I specify the version here so that you install the same version as mine. This command will automatically build the structure of our Laravel application and then install the various dependencies necessary for its operation.


Upon installation you will notice that Laravel has created several folders and files for you.

  • At the root of our project, we have a folder app which will contain the code of our application. This folder will also be the root of the namespace \App. Inside this folder, we will find different folders that correspond to classes pre-designed by Laravel, but we will have the opportunity to come back to them when we start writing our first lines of code. For now, you just need to know that it’s in this folder that you will write most of your code.
  • The folder bootstrap is not necessarily a folder that you will touch, but it contains the code that will allow you to start a Laravel application.
  • The folder config which will be an important folder that will contain the configuration of the various elements of the framework. For example, the “mail.php” file will allow you to configure the mailing system, the “cache.php” file will allow you to configure the cache and we have one file for each type of configuration that we can do. Inside these files the configuration is given in the form of an associative array.
  • The folder database will contain the different elements concerning the database. Inside, there are three files, which we will discuss later.
  • The folder audience will serve as the root for our application. When we create a web server, this folder will be used as the root to run our application. Everything that is in the “public” folder will be, as its name suggests, publicly accessible and we find inside the “index.php” file which will be the real entry point of Laravel.
  • THE resources contains CSS and JavaScript resources that will be used for the front-end, but it will also contain a folder view which will allow you to specify the files that will allow you to generate the HTML pages.
  • The folder roads will contain the paths of our application. This is what makes it possible to say “when I go to the homepage, this is what I must do”. So we have different categories of roads depending on what we can do. The routes for the API part, for the web application part, for the console, and the channels for the websockets.
  • Finally, the file storage will contain the files generated by the application (cache and user upload).

Finally, a file .env has also been created for you and contains environment variables used to configure the general operation of the application. This file should not be versioned (a .gitignore file has already been created).

The craftsman order

At the root of the project we will also find a file artisan which allows you to control the basic operations of Laravel from the terminal. For example, if we want to start the web server that runs our application, we can use the serve command.

php artisan serve

This command allows you to start a web server on port 8000 which makes your application accessible (during development) via localhost:8000.


Please enter your comment!
Please enter your name here