laravel-patterns

Define and apply Laravel architectural patterns for controllers, services, and domain logic.

1|1|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/zardusai-cyber/zardus_setup --skill laravel-patterns-zardusai-cyber
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-patterns
Source: https://github.com/zardusai-cyber/zardus_setup/tree/main/ecc/skills/laravel-patterns
Command: npx skills add https://github.com/zardusai-cyber/zardus_setup --skill laravel-patterns-zardusai-cyber

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Organizes Laravel projects into clear architectural layers (controllers, services, actions) and modeling patterns, enabling scalable, maintainable codebases for APIs, background jobs, and complex domain logic.

Core Features & Use Cases

  • Layered architecture: Controllers -> Services/Actions -> Models to keep business rules isolated from HTTP concerns.
  • Eloquent patterns: relationships, casts, scopes, and query patterns to express domain logic clearly.
  • API and routing: resource controllers, route model binding, and services to support scalable APIs and pagination.
  • Queues, events, caching: push heavy work to queues, raise events, and cache expensive reads for performance.

Quick Start

Organize your Laravel project into controllers, services, and models and wire routes, resources, and queues as shown.

Frequently Asked Questions about laravel-patterns

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

FAQPage Schema
How do I structure a Laravel application with controllers, services, and domain logic?

To structure a scalable Laravel application, organize your project into a layered architecture. This isolates business rules in services and actions, keeping HTTP concerns separate from models for a maintainable codebase.

What is the best way to separate API routing and business logic in Laravel?

The best way to separate API routing and business logic in Laravel is using resource controllers, route model binding, and domain-focused services. This approach ensures clear separation of concerns and supports scalable APIs with efficient pagination.

How do I use Eloquent patterns to express domain logic clearly?

Eloquent patterns express domain logic clearly by leveraging relationships, casts, and custom query scopes. This allows your models to directly represent domain rules and data access patterns without cluttering controllers or services.

When should I push heavy work to queues, raise events, and cache reads in Laravel?

Push heavy work to queues, raise events, and cache expensive reads in Laravel when building scalable production applications. This pattern offloads intensive processing and optimizes performance for background jobs and complex domain logic.

Do I need a service layer for scalable Laravel API development?

A service layer is highly recommended for scalable Laravel API development. It enforces a conventional project layout, binding patterns, and domain-focused services to ensure clear separation of concerns across production-grade applications.

Why does my Laravel codebase lack clear separation of concerns for complex domain logic?

Your Laravel codebase lacks clear separation of concerns without applying architectural patterns. Organizing code into controllers, services, and actions isolates complex domain logic from HTTP concerns, enabling a maintainable and scalable structure.