Laravel is a popular open-source PHP framework known for its elegant syntax, expressive features, and developer-friendly environment. Taylor Otwell created it and was first released in 2011. Laravel follows the Model-View-Controller (MVC) architectural pattern, which provides a structured approach to web application development.
Laravel Folder Structure
The default folder structure in Laravel 9 follows a similar pattern to previous versions but with a
few changes and additions. Here's an overview of the Laravel folder structure in Laravel 9:
1. app: This folder contains the core files of your application. It includes subfolders like:
- Console: Contains console commands and related files.
- Events: Contains event classes used for event-driven programming.
- Exceptions: Holds exception classes that handle application exceptions.
- Http: Contains controllers, middleware, and other classes related to HTTP request handling.
- Models: Here, you define the data models or classes that represent your application's data
structure.
- Providers: Contains service providers that bootstrap various components of the application.
2. bootstrap: This folder contains files necessary for the application's bootstrapping process, such as
the `app.php` file that initializes the Laravel framework.
3. config: Configuration files for the application are stored here. It includes files like `app.php` for
general application settings, `database.php` for database connections, and `mail.php` for email
configurations.
4. database: This folder includes database-related files:
- migrations: Laravel provides a migration system to manage database schema changes. Migration
files are stored here.
- seeders: This folder is used to store database seed files that allow you to populate the database
with test or initial data.
5. public: The web server's document root should point to this folder. It contains the entry point
(`index.php`) for your Laravel application, as well as assets like CSS, JavaScript, and image files.
6. resources: This folder holds files related to front-end development:
- css: Contains CSS stylesheets for the application.
- js: Contains JavaScript files for the application.
- lang: Localization files for supporting multiple languages.
- views: Raw, uncompiled Blade templates go here.
7. routes: This folder contains route definition files that determine how incoming requests should be
handled by the application.
8. storage: This folder includes files generated by the framework during runtime:
- app: Stores application-generated files like logs, cache, and other temporary files.
- framework: Stores files generated by the Laravel framework itself, such as cache files and
session data.
9. tests: This folder is used for storing automated tests for your application.
10. vendor: This folder contains the dependencies installed via Composer, including the Laravel
the framework itself and any third-party packages.
11. .env: The `.env` file holds environment-specific configuration settings such as database
credentials, application URLs, and more. It's important to note that while this provides an overview of the default Laravel folder structure,
you can customize and organize your application's folders based on your specific requirements.
Laravel offers flexibility in configuring the folder structure to suit your project's needs.
It's important to note that while this provides an overview of the default Laravel folder structure,
you can customize and organize your application's folders based on your specific requirements.
Laravel offers flexibility in configuring the folder structure to suit your project's needs.
Create New middleware for the route. php artisan make:middleware MyrouteMiddleware ..
Create a New Middleware php artisan make:middleware NameOfMiddleware This is..
Middleware can verify the user's authentication status and ensure they have the necessary credential..
We have created a view page name as login.blade.php <div class="col-sm-4"><h3>L..
Suppose you have data and you need to check it by clicking or page onload. first, create a controll..
Blade is a templating engine used in Laravel, a popular PHP framework. It provides a simple and expr..
Current Url <div class="container-fluid p-5 bg-primary text-white text-center"><h1..
A component is a group of code like a header or footer. Which are re-useable. Common part ofapplicat..
In Laravel, a controller is a class that handles the logic and acts as an intermediary between themo..
It's Easy to create routes. Already we know That all route files should be kept in the routes ..
The blade is the templating engine used in Laravel, which is a popular PHP framework. It provides at..
Laravel is a popular open-source PHP framework known for its elegant syntax, expressive features, an..
In Laravel, you can set dynamic page titles by utilizing the power of Blade templating and passing d..
To set up a Laravel project with Bootstrap, you can follow these steps: Create a project, I..
How to Install Laravel using Composer First, we need to install Composer. check How to inst..
How to Install Composer on Linux Open terminal php -r "copy('https://getcomposer.o..
Get the latest news and updates by signing up to our daily newsletter.We won't sell your email or spam you !