Post Top Ad

Monday, November 27, 2017

Exploring Laravel 5.5 structure





I assume that you've installed Laravel at ~/Code/Laravel. Let's go there and open the Laravel directory.
Laravel structure

To build applications using Laravel, you will need to understand truly Laravel.
Laravel follows MVC (Model View Controller) pattern, so if you've already known about MVC, everything will be simple. Don't worry if you don't know what MVC is, you will get to know soon.
As you may have seen, every time you visit a Laravel app, you'll see these folders.
  1. app
  2. bootstrap
  3. config
  4. database
  5. public
  6. resources
  7. routes
  8. storage
  9. tests
  10. vendor
I'm not going to tell you everything about them right now because I know that it's boring.
Trust me.
But we have to take a quick look at them to know what they are, anyway.
App
This directory holds all our application's logic. We will put our controllers, services, filters, commands and many other custom classes here.
Bootstrap
This folder has some files that are used to bootstrap Laravel. The cache folder is also placed here.
Config
When we want to configure our application, check out this folder. We will configure database, mail, session, etc. here.
Database
As the name implies, this folder contains our database migrations and database seeders.
Public
The public folder contains the application's images, CSS, JS and other public files.
Resources
We should put our views (.blade.php files), raw files and other localization files here.
Routes
All our route files will be stored here.
We'll learn about this routes directory in the next section.
Storage
Laravel will use this folder to store sessions, caches, templates, logs, etc.
Tests
This folder contains the test files, such as PHPUnit files.
Vendor
Composer dependencies (such as Symfony classes, PHPUnit classes, etc.) are placed here.
To understand more about Laravel structure, you can read the official documentation here:

No comments:

Post a Comment