SOLID principles for Laravel 12 and PHP 8.5. Files < 100 lines, interfaces separated, PHPDoc mandatory. Auto-detects Laravel and FuseCore architecture.
View on GitHubFebruary 2, 2026
Select agents to install to:
npx add-skill https://github.com/fusengine/agents/blob/main/plugins/laravel-expert/skills/solid-php/SKILL.md -a claude-code --skill solid-phpInstallation paths:
.claude/skills/solid-php/# SOLID PHP - Laravel 12 + PHP 8.5 ## Agent Workflow (MANDATORY) Before ANY implementation, launch in parallel: 1. **fuse-ai-pilot:explore-codebase** - Analyze existing architecture 2. **fuse-ai-pilot:research-expert** - Verify Laravel/PHP docs via Context7 3. **mcp__context7__query-docs** - Check SOLID patterns After implementation, run **fuse-ai-pilot:sniper** for validation. --- ## Auto-Detection | Files Detected | Architecture | Interfaces Location | |----------------|--------------|---------------------| | `composer.json` + `artisan` | Laravel Standard | `app/Contracts/` | | `app/Modules/` directory | FuseCore Modular | `app/Modules/[Feature]/Contracts/` | | `routes/modules.php` | FuseCore Modular | `app/Modules/[Feature]/Contracts/` | **Verification**: `php artisan --version` → Laravel 12.x --- ## Decision Tree: Where to Put Code? ``` New code needed? ├── HTTP validation → app/Http/Requests/ ├── Single action → app/Actions/ ├── Business logic → app/Services/ (or Modules/[X]/Services/) ├── Data access → app/Repositories/ ├── Data transfer → app/DTOs/ ├── Interface → app/Contracts/ ├── Event → app/Events/ └── Authorization → app/Policies/ ``` --- ## Decision Tree: Which Pattern? | Need | Pattern | Location | Max Lines | |------|---------|----------|-----------| | HTTP handling | Controller | Controllers/ | 50 | | Validation | FormRequest | Requests/ | 50 | | Single operation | Action | Actions/ | 50 | | Complex logic | Service | Services/ | 100 | | Data access | Repository | Repositories/ | 100 | | Data structure | DTO | DTOs/ | 50 | | Abstraction | Interface | Contracts/ | 30 | --- ## Critical Rules (MANDATORY) ### 1. Files < 100 lines - **Split at 90 lines** - Never exceed 100 - Controllers < 50 lines - Models < 80 lines (excluding relations) - Services < 100 lines ### 2. Interfaces Separated ``` app/Contracts/ # Interfaces ONLY ├── UserRepositoryInterface.php └── PaymentGatewayInterface.php ``` ### 3. PHPDoc Mandatory ```php /**