Home » Laravel

Project Structure of Laravel Project

In this tutorial, we are going to learn about the project structure of Laravel project.
Submitted by Bharti Parmar, on November 08, 2019

Open your project: At first, we will see the main directories which we are using the most and which are useful.


  • Database create
  • Managing reservation in hotel
  • Setting up an authentication layer
  • Basic CRUD
  • Laravel is easy to move from one product to another.

1) Pre-defined laravel files: a couple of directories with some root-level files.

2) app directory:

  • console: It is a command-line interface in Laravel.
  • Laravel is an MVC framework where model access the database, views present the front end for our end-user and controller lives in between two.
project structure of laravel | setp 1

Now, let us learn about all the important directories which we have to use to create a Laravel project.

1) Exception directory: This directory contains the application of an exception handler. Here, we can add any custom exception as well as custom logic for handling an exception. Handler.php file is an exception handling file that automatically, finds an error and shows you on the browser.

2) http: It contains all the request middleware and controllers. it is big in comparison to the similar / other files. it is accessed from the web browser.

  • controller:
    • middleware
    • view composer
    • view creators
    • all binds of goodies
  • If you want to make controller then,
    project structure of laravel | setp 2
  • Similarly, you can make model,
    project structure of laravel | setp 3
  • Provider: It contain user model. In this we can hook custom logic into our laravel application at a global level.
    • user.php: User model are already created and another project models are also placed here (under provider directory).

3) Bootstrap: It configure bootstrap and bootstrap framework auto-loading and catch. It is used to load our application.

4) Config: It contains all the application files like HTML, image, view. Editor config/config file is similar to PHP configuration file. config is where we will control the configuration of our application.

  • app.php: for illuminate html, forms, views we use app.php file.

    project structure of laravel | setp 4

    project structure of laravel | setp 5
  • database.php: for database
    connections: different types of database connections are there and here we use MySQL. If you want to use a different database then its connection is also there. we have to set DB, DB_name and password for the connection.

    project structure of laravel | setp 6
  • mail.php: It makes the configuration of sending email to any file by setting driver, host, port, name, password, etc.

    project structure of laravel | setp 7
  • view.php: Here, the base path is given. It indicates the view page whatever view you want to show to the users.

    project structure of laravel | setp 8

4) database: It is where we will be set up our databases into base save and other migrations which give us the ability to essentially version database.
database --> * factories, * migration, *seeds

5) public: It is for the public where public resources will be stored. like: CSS,js and other application files.

6) resources: It is an unmagnified version of our CSS and js as well as the 'views' files that contain HTML.

Unmanified CSS and js: Removing unnecessary lines and spaces in the source code of a page without changing their functionality.

7) routes: It contains routes of our application.

8) storage: It is used to stores any long term files such as log and coaching files.

9) tests: It contains the test files for testing the application.

10) vendor: This is the directory where the composer installs the various packages we need to make our PHP application work.

Note: Here .env file is our working file which is known as environment file.


In this article, we have learned about different directories in the project in laravel framework. We will know more about it in the upcoming article. Have a nice day! Happy Learning!


Comments and Discussions!

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.