When you create a new Laravel project, you’ll see the following key directories:
app/
(Application Logic)📌 Example: A User
model is stored in:
app/Models/User.php
routes/
(Application Routes)web.php
(for web routes)api.php
(for API routes)📌 Example: Defining a route in web.php
Route::get('/welcome', function () {
return "Welcome to Laravel!";
});
resources/
(Views & Frontend Assets)resources/views/
).resources/css
, resources/js
).📌 Example: Creating a welcome.blade.php
file
<h1>Welcome to Laravel!</h1>
database/
(Database Migrations & Seeds)📌 Example: Running a migration
php artisan migrate
public/
(Publicly Accessible Files)index.php
entry file.config/
(Application Configurations).env
file manages database settings.📌 Example: Setting the database in .env
DB_DATABASE=laravel_db
DB_USERNAME=root
DB_PASSWORD=
Laravel’s structure helps organize code efficiently. Understanding these directories makes development easier and more manageable.
🎯 Next Steps: Learn about Controllers, Models, and Views in Laravel. 🚀