laravel-patterns
Master Laravel's architecture through proven patterns for building maintainable, production-ready applications. Covers controller and service layer design, Eloquent modeling with relationships and scopes, API resource structuring, and background job handling with queues and events.
Laravel Patterns teaches production-grade architecture for building scalable, maintainable Laravel applications.
AI-generated summary based on this skill's SKILL.md
Install
affaan-m/ECC/laravel-patterns · repository language: JavaScript
git clone https://github.com/affaan-m/ECC
cp -r ECC/skills/laravel-patterns ~/.claude/skills/laravel-patternsnpx skillfed install affaan-m/ECC/laravel-patternsFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What are the core Laravel architecture patterns covered?
laravel-patterns teaches production-grade Laravel architecture and design patterns for building maintainable applications. The skill covers structuring controllers, services, and models with clear boundaries; mastering Eloquent ORM with relationships, scopes, and query optimization; building scalable APIs with resources, routing, and pagination; and implementing queues, events, caching, and background job patterns. You'll learn proven approaches to separate concerns and keep your codebase organized as it grows.
How should I structure Laravel controllers and services?
laravel-patterns emphasizes clear separation between controllers and services to maintain single responsibility. Controllers handle HTTP requests and responses, while services contain business logic. This boundary prevents fat controllers and makes testing easier. The skill teaches how to inject services into controllers via Laravel's service container, organize related business logic into focused service classes, and use action classes for complex operations. This structure scales well as your application grows.
What does laravel-patterns teach about Eloquent ORM best practices?
laravel-patterns covers Eloquent ORM mastery including relationships (one-to-many, many-to-many, polymorphic), query scopes for reusable filtering, and optimization techniques. Key topics include avoiding N+1 queries through eager loading, using global scopes for soft deletes and other cross-cutting concerns, building efficient query builders, and leveraging Eloquent's relationship methods. The skill shows how to structure models with clear relationships and use scopes to keep queries DRY and performant.
How do I build scalable APIs with routing and model binding?
laravel-patterns teaches API design through resource classes for consistent response formatting, nested routes with scoped bindings for clean URL structures, and pagination strategies for large datasets. You'll learn to use implicit and explicit model binding to automatically resolve route parameters, structure API resources to transform Eloquent models into JSON, implement pagination for efficient data delivery, and organize routes logically. These patterns ensure your APIs remain maintainable and performant as they scale.
What background job and event patterns does laravel-patterns cover?
laravel-patterns covers queues for offloading long-running tasks, events and listeners for decoupled communication, and caching strategies for performance. You'll learn to dispatch jobs to background queues, set up event listeners that respond to application events, implement retry logic and failure handling, use caching to reduce database queries, and coordinate multi-step updates with transactions. These patterns keep your application responsive and handle complex workflows reliably.
How does laravel-patterns address form validation and database migrations?
laravel-patterns teaches form validation through request classes that centralize validation rules and custom messages, keeping controllers lean. For databases, you'll learn to structure migrations for schema changes, use transactions for multi-step updates, implement soft deletes with global scopes, and design schemas that support your application's relationships. The skill emphasizes validation as a first line of defense and migrations as version control for your database structure.
SKILL.md
rendered from the published skill — quoted content, verbatim
Laravel Development Patterns
Production-grade Laravel architecture patterns for scalable, maintainable applications.
When to Use
- Building Laravel web applications or APIs
- Structuring controllers, services, and domain logic
- Working with Eloquent models and relationships
- Designing APIs with resources and pagination
- Adding queues, events, caching, and background jobs
How It Works
- Structure the app around clear boundaries (controllers -> services/actions -> models).
- Use explicit bindings and scoped bindings to keep routing predictable; still enforce authorization for access control.
- Favor typed models, casts, and scopes to keep domain logic consistent.
- Keep IO-heavy work in queues and cache expensive reads.
- Centralize config in
config/*and keep environments explicit.
Examples
Project Structure
Use a conventional Laravel layout with clear layer boundaries (HTTP, services/actions, models).
Recommended Layout
``` app/ ├──
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
skills/laravel-patterns/SKILL.md