.


Divya


Directory Structure of Laravel


The image is showing the files and directories of laravel. It is automatically created when we create project using composer or laravel installer.

Let's we overview these files and directories

first we understand about files

.env :

This is environment file where we put credential(username password and other information) which will use in project. Ex. Database username, password, database name , any third party creds like Mailgun,redis etc.

We can change the path of this file for more security purpose. go to vendor\vlucas\phpdotenv\src\Loader and change it in constructor.

Note: we must never commit this file in bitbucket or github. You may check is already mentioned in gitignore file.

.gitattribute

It just hint about git. Don't think more about this file.

.gitignore

Here we put file name which will not commit in bitbucket or git repos.

artisan

when we run php artisan command in terminal actually we trigger this file only. It run The Artisan Application.

composer.json

This is the configuration file that specifies all dependencies or dependencies for development purpose

composer.lock

It lock the version of dependencies.So, In future when we'll install dependency, Intall same version.

package.json

This is relatated to frontend dependency. you may find the which frontend dev dependencies (with version) is installed. Ex.vue,jquery etc.

server.php

This file allows us to emulate Apache's "mod_rewrite" functionality from the built-in PHP web server.

webpack.mix.js

It compiles scss or less or js files.

vendor Directory

This directory contain the core files of composer so no need to worry about this and here we don't create files/folders write code in existing files.

test Directory

This directory contain the test code of our project for testing purpose.

storage Directory

It stores logs, files based session and other thing. we don't more worry about this folder.

route Directory

api.php

Here we can register API routes for our application.

channels.php

Here we may register all of the event broadcasting channels that our application supports.

console.php

Here we may define all of our Closure based console commands and run on terminal. ex. php artisan inspire or php artisan foobar etc.

web.php

we can register web routes for our application. ex. Route::get('/','RegisterController@index'); Route::post('/register','RegisterController@register');



.