affaan-m avatar

Laravel Patterns

This walks you through production Laravel architecture: controllers stay thin, orchestration goes in services, single-purpose logic in actions, and everything flows through clear layer boundaries. You get specific patterns for route model binding with scopes to prevent cross-tenant access, Eloquent conventions like typed casts and query scopes to keep domain logic out of controllers, and practical examples for queues, events, and caching. The routing section is especially useful if you've ever tangled yourself in nested resource routes or wondered when to use explicit bindings. It's opinionated about structure but in a way that makes refactoring easier six months later. Good for teams that want consistency without fighting the framework.

skills.sh installs
6.1K
GitHub stars
300.3K
last updated
Aug 21, 2026

Install

$ npx -y skills add affaan-m/ecc --skill laravel-patterns --agent claude-code

Installs into .claude/skills of the current project.

Files

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

Sponsors

Details

Repository
github.com/affaan-m/ecc
Categories
Backend & APIs, Code Review & Quality, PHP & Laravel, Databases
First seen
Jul 14, 2026

More from affaan-m/ecc

All 263
1affaan-m avatarspringboot-patternsaffaan-m/eccSpring Boot architecture patterns, REST API design, layered services, data access, caching, async processing, and logging. Use for Java Spring Boot backend work6.1Kskills.sh installs
2jeffallan avatarnextjs-developerjeffallan/claude-skillsUse when building Next.js 14+ applications with App Router, server components, or server actions. Invoke to configure route handlers, implement middleware, set 6Kskills.sh installs
3wordpress avatarwordpress-routerwordpress/agent-skillsUse when the user asks about WordPress codebases (plugins, themes, block themes, Gutenberg blocks, WP core checkouts) and you need to quickly classify the repo 6Kskills.sh installs
4grafana avatargrafana-ossgrafana/skillsConfigure Grafana OSS — provisions dashboards from YAML, sets up data sources (Prometheus / Loki / Tempo / Pyroscope), writes dashboard JSON with template varia6Kskills.sh installs
5affaan-m avatarjira-integrationaffaan-m/eccUse this skill when retrieving Jira tickets, analyzing requirements, updating ticket status, adding comments, or transitioning issues. Provides Jira API pattern6Kskills.sh installs
6jeffallan avatarfullstack-guardianjeffallan/claude-skillsBuilds security-focused full-stack web applications by implementing integrated frontend and backend components with layered security at every level. Covers the 5.9Kskills.sh installs