Laravel Project Structure
A scalable and maintainable folder structure for Laravel applications
File Structure
- app
- Http
- Controllers
- Middleware
- Requests
- Models
- Providers
- Events
- Listeners
- Jobs
- Notifications
- bootstrap
- config
- database
- migrations
- seeders
- factories
- public
- css
- js
- images
- resources
- views
- lang
- sass
- js
- routes
- web.php
- api.php
- console.php
- storage
- tests
- Feature
- Unit
- vendor
- .env
- composer.json
- README.md
Directory Structure Explanation
app/Http/Requests/
Contains form request classes for validating incoming HTTP requests.
app/Events/
Contains event classes for triggering application events.
app/Listeners/
Contains listener classes that handle triggered events.
app/Jobs/
Contains job classes for queueing tasks to be processed asynchronously.
app/Notifications/
Contains notification classes for sending notifications to users.
database/factories/
Contains factory classes for generating fake data for testing.
resources/js/
Contains JavaScript files for client-side functionality, often used with tools like Vue.js or React.
routes/console.php
Defines Artisan commands for the application.
tests/Feature/
Contains feature tests for testing application behavior.
tests/Unit/
Contains unit tests for testing individual components.