Laravel - Application Structure


Root Directory

The root directory of Laravel contains various folders and files as shown in the following figure.

Root Directory
  • app − This directory contains the core code of the application.

  • bootstrap − This directory contains the application bootstrapping script.

  • config − This directory contains configuration files of application.

  • database − This folder contains your database migration and seeds.

  • public − This is the application’s document root. It starts the Laravel application. It also contains the assets of the application like JavaScript, CSS, Images, etc.

  • resources − This directory contains raw assets such as the LESS & Sass files, localization and language files, and Templates that are rendered as HTML.

  • storage − This directory contains App storage, like file uploads etc. Framework storage (cache), and application-generated logs.

  • test − This directory contains various test cases.

  • vendor − This directory contains composer dependencies.

App Directory

This is the application directory. It contains a variety of additional directories, which are described below −

  • Console − All the artisan commands are stored in this directory.

  • Events − This directory stores events that your application can raise. Events may be used to alert other parts of your application that a given action has occurred, providing a great deal of flexibility and decoupling.

  • Exceptions − This directory contains your application's exception handler and is also a good place to stick any exceptions thrown by your application.

  • Http − This directory contains your controllers, filters, and requests.

  • Jobs − This directory contains the queueable jobs for your application.

  • Listeners − This directory contains the handler classes for your events. Handlers receive an event and perform logic in response to the event being fired. For example, a UserRegistered event might be handled by a SendWelcomeEmail listener.

  • Policies − This directory contains various policies of the application

  • Providers − This directory contains various service providers.