laravel-patterns

Structure Laravel applications with repository, service, controller, and resource patterns.

Updated Apr 10, 2026
One-click install
npx skills add https://github.com/majedsiefalnasr/bunyan-app-cursor --skill laravel-patterns-majedsiefalnasr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-patterns
Source: https://github.com/majedsiefalnasr/bunyan-app-cursor/tree/main/.agents/skills/laravel-patterns
Command: npx skills add https://github.com/majedsiefalnasr/bunyan-app-cursor --skill laravel-patterns-majedsiefalnasr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Laravel projects often suffer from tangled controllers and ad-hoc data access, which makes maintenance hard as features grow; standardizing architecture with repository, service, controller, requests, and resource patterns helps teams stay consistent and scalable.

Core Features & Use Cases

  • Repository-pattern for data access separation and testability
  • Service-pattern for business logic orchestration and reuse
  • Controller-, Form Request-, and API Resource-patterns for clean API surfaces
  • Versioned routing pattern to support stable API evolution

Quick Start

Adopt the repository-service-controller-resource pattern in your Laravel project to structure code and enforce separation of concerns.

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 to separate data access and business logic?

Structure Laravel applications by separating concerns into repositories for data access, services for business logic orchestration, and thin controllers to promote testability and maintainability in scalable apps.

What is the repository pattern used for in Laravel API design?

The repository pattern in Laravel separates data access logic from business logic, enabling better testability and consistency. It is applied to handle data models cleanly within medium-to-large applications.

How do I keep Laravel controllers clean when handling complex domain logic?

Keep Laravel controllers clean by making them thin and delegating business logic orchestration to idempotent services, while using FormRequests for validation and Resources for data shaping.

When should I use service and repository patterns in my Laravel project?

Use service and repository patterns in medium-to-large Laravel apps with complex domain logic, multiple data models, and evolving APIs where consistency, testability, and scalability matter.

What is the best way to version Laravel API routes for stable evolution?

The best way to support stable API evolution in Laravel is by applying a versioned routing pattern, which isolates changes and maintains backward compatibility for existing API consumers.

Can I use API Resources and FormRequests to shape and validate Laravel API responses?

Yes, you can use API Resources for data shaping and FormRequests for validation to create clean API surfaces, ensuring consistent data transformation and rule enforcement before reaching controllers.