| name | laravel-modular-structure |
| description | Create and maintain module-wise folder structure in Laravel for organizing code by features like Student Management, Staff Management, etc. Includes controllers, models, views, routes, and migrations per module. |
Laravel Modular Structure Skill
Package-Based Modular Architecture (RECOMMENDED)
Each module is a self-contained package under app/Packages/. See package-based-architecture skill for detailed implementation.
Structure
app/Packages/StudentManagement/src/
โโโ Controllers/
โ โโโ StudentController.php (Web)
โ โโโ Api/
โ โโโ StudentApiController.php (REST API)
โโโ Models/
โ โโโ Student.php
โ โโโ ParentInfo.php
โ โโโ PreviousEducation.php
โ โโโ HealthRecord.php
โโโ Views/
โ โโโ student/
โ โโโ index.blade.php
โ โโโ create.blade.php
โ โโโ show.blade.php
โ โโโ edit.blade.php
โโโ Routes/
โ โโโ web.php
โ โโโ api.php
โโโ Providers/
โ โโโ StudentManagementServiceProvider.php
โโโ Requests/ (Form Validation)
โโโ Resources/ (API Resources)
โโโ Database/
โโโ migrations/
Student Management - Implemented โ
Package: app/Packages/StudentManagement/src/
- Controllers: StudentController (Web), StudentApiController (API)
- Models: Student, ParentInfo, PreviousEducation, HealthRecord
- Views: index, create, show, edit with Tailwind styling
- Routes: Web routes (resource), API routes (apiResource)
- Service Provider: StudentManagementServiceProvider registered in
laravel/bootstrap/providers.php
Benefits
โ
True modularity - each package is independent
โ
Easy to remove or disable packages
โ
Clear separation of concerns
โ
View namespace isolation (student-management::)
โ
Self-contained routing (no main routes file clutter)
โ
Scalable to 20+ modules
Goals
- Implement all 10 modules as packages
- No dependencies between packages (except models)
- Independent testing and development
Goals
- Improve code organization and maintainability.
- Allow for easier feature development and testing.
- Scale to handle 10+ modules (Staff, Classes, Subjects, etc.).