Learn laravel directory structure

Hello World,Today i am going to create article in which we will learn laravel directory structure. In this article, we will learn about all folders and files at the root path of laravel.

Following is the directory structure screenshot of laravel.

learn-laravel-directory-structure-screenshot

Lets walk through one by one to get familiar. The root directory contains the following folder by default.


App

In this folder your actual application will work. All the controllers, modes, commands and your php domain code all go in here.

Bootstrap

This folder contains the files that the laravel framework use to boot every time it runs.

Config

This folder contains the all configuration files

Database

In this folder, All the database, migrations, seeds and factories are live.

Public

The directory the server points to when its serving the website. The index.php, which is the front controller that kicks off the bootstrapping process and routes all request appropriately. Its also where any public-facing files like images, stylesheets, scripts, or downloads go.

Resource

Where files that are needed for other scripts live. Views, langauge files, and Sass/Less/Source CSS and source Javascript files.

Routes

Here all the routes definition are live, both  for HTTP routes and Console routes or artisan commands.

Storage

Where Caches, logs and compiled system files live.

Test

Where unit and integration tests live.

Vendor

Where composer installs its decencies. Its git-ignored, as composer is expected to run as a part of your deploy process on any remote servers.


Following are some loose files which has been defined as follow:

.editorconfig

Gives your IDE/Text editor instructions about laravel’s coding standards like the size of indents, the charset, and whether to trim trailing whitespace. You will see this in any laravel apps running greater than or equal to version 5.5.

.env and .env.example

Dictate the enviroment variables. .env.example is a template that each enviroment should duplicate to create its own .env file, which is GIT-ignored

.gitignore and .gitattributes

These files contains git configuration.

Artisan

Allow you to run artisan commands from the command line.

composer.json and composer.lock

Configuration files for composer, This file is editable. composer.lock is not editable. These files share some basic information about the project and also define its php dependencies.

package.json

package.json like composer.json but for frontend assets and dependencies of the build system; it instruct NPM to install defined packages.

PHPUnit

This file is use to perform PHPUnit.

readme.md

This markdown file gives the basic introduction of laravel.

server.php

A backup server that tries to allow less-capable servers to still preview the laravel application.

webpack.mix.js

The configuration file for mix. These files are giving you build system directions on how to compile and process your frontend assets.


I hope you are enjoying my tutorials. Please add your feedback in the comment section. Thank you. 🙂 🙂

Leave a Reply