laravel-solid

Enforces SOLID coding standards for Laravel PHP classes including controllers, services, DTOs, and gateways.

1|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/MoisesCorcho/anime-recommender --skill laravel-solid-moisescorcho
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: laravel-solid
Source: https://github.com/MoisesCorcho/anime-recommender/tree/main/.agents/skills/laravel-solid
Command: npx skills add https://github.com/MoisesCorcho/anime-recommender --skill laravel-solid-moisescorcho

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Laravel projects often drift into inconsistent architecture: fat controllers, business logic in models, raw arrays passed between layers, and untyped code. This Skill enforces a single, non-negotiable SOLID coding standard so every generated or reviewed PHP class follows the same Laravel-native structure without hexagonal or DDD over-engineering. ## Core Features & Use Cases - Thin Controller Enforcement: Ensures controllers only receive requests, delegate to injected service interfaces, and return responses, with validation isolated in FormRequest classes. - Interface and Gateway Contracts: Requires service interfaces in app/Contracts/Services and gateway wrappers for all external API integrations, with bindings registered in a ServiceProvider. - Immutable DTOs and Strict Typing: Mandates final readonly DTOs with fromArray()/toArray() methods, declare(strict_types=1) in every file, full type hints, and disciplined PHPDoc usage. - Use Case: When asking an AI to generate a new anime recommendation endpoint, the output automatically follows the canonical pattern: a thin controller, a FormRequest, a RecommendationRequestDto, and an interface-injected service. ## Quick Start Generate a new Laravel controller and service for anime favorites following the project's SOLID coding standard.

Frequently Asked Questions about laravel-solid

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Laravel controllers following SOLID principles?▼

Keep controllers thin: inject service interfaces via the constructor, validate input with FormRequest classes, map validated data to a DTO using fromArray(), and delegate all business logic to the service. Never place Eloquent queries or domain branching in controllers.

How to pass data between layers in a Laravel application?▼

Use immutable DTOs declared as final readonly classes in app/DataTransferObjects instead of associative arrays. Each DTO must implement fromArray(array $data): static for hydration and toArray(): array for serialization to responses, jobs, or logs.

Should Laravel services use interfaces and dependency injection?▼

Yes, every service should implement a focused interface stored in app/Contracts/Services, with bindings registered in a ServiceProvider. Controllers and jobs must type-hint the interface, never the concrete class, enabling mocking and swapping implementations.

Does this standard support hexagonal architecture or DDD in Laravel?▼

No, the standard explicitly prohibits hexagonal architecture and domain-driven design patterns. It uses Laravel-native structure with SOLID principles applied pragmatically: Contracts, Services, Gateways, DTOs, and anemic models.

When are PHPDoc blocks required in strictly typed PHP code?▼

PHPDoc is required only when it adds context types cannot express: generic collections like @param array<int, AnimeDto>, propagating exceptions via @throws, and class-level business descriptions. It is forbidden when merely restating the type signature.