Application Structure in Laravel

 

Here we ‘ll look at the application structure of this elegant framework Laravel.
In previous posts,  about introduction to laravel and how to install laravel framework , we now look at the application structure of laravel.
For creating a laravel application , in the terminal type laravel new projectname it will create a new laravel application in the specified location.

Laravel Application Structure

When we first open  our project , we can see some application structure – folders and files that are already created ,

justLaravel - Laravel Application Structure
Laravel Application Structure
app folder, is the main part of the application , all the major part of the code we develop resides in this app folder. It contains Controller files, Model files, Routing file, Request files, handler files and many more, the meat of the application lives here in the app directory.

justLaravel – App directory structure
App directory structure
bootstrap folder, contains few files which are required to when starting the application. It contains autoload files , cache files etc.
config folder, as the name suggests it contains all configuration files for app configuration like whether to allow debugging or not ., database configuration like the database name , host ., mail configuration file, file system configurations.
database folder, contains all files and folders to create and delete schemas and tables.
public folder, contains the front controller, index file, which loades first when the application starts and some other files like .htaccess and robots.txt files.
resources folder, contains all raw assets like css and javacripts , all the view files resides in this directory.
storage folder, contains all the auto generated compiled view(blade template) files,  some files about cache and sessions.
test folder, as name suggests it contains all the automated tests.
vendor folder, contains all composer dependencies .  If  vendor folder does’nt exist , we need to run composer install or composer update commands in the root directory of the project.
artisan file, which is a command line interface, many of the commands we use while developing the application are provided by artisan command.
php artisan list shows all the available commands with artisan

justLaravel - Application Structure - artisan command
artisan command
.env file, which is created when we create an application, it contains information about database settings, application key, port settings.
This is how laravel project is structured, check previous posts on introduction to larvel and installing larvel for any reference.
Powered by Blogger.