Skip to content
Back to skills

Laravel Architecture

ASecurity

Core architectural standards for scalable Laravel applications. Use when structuring service layers, repositories, or scalable architecture in Laravel. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)

  • 67 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
ai-agentsphpdatabase

Security analysis

A100/100

Scanned November 10, 2026

npx -y skills add ComeOnOliver/skillshub --skill laravel-architecture --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Laravel Architecture?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Laravel Architecture
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/comeonoliver-laravel-architecture/badge)](https://www.skillsdirectory.com/skills/comeonoliver-laravel-architecture)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: laravel-architecture
description: 'Core architectural standards for scalable Laravel applications. Use when structuring service layers, repositories, or scalable architecture in Laravel. (triggers: app/Http/Controllers/**/*.php, routes/*.php, controller, service, action, request, container)'
---

# Laravel Architecture

## **Priority: P0 (CRITICAL)**

## Structure

```text
app/
├── Http/
│   ├── Controllers/    # Slim (Request/Response only)
│   └── Requests/       # Validation logic
├── Services/           # Business logic (Optional)
└── Actions/            # Single-purpose classes (Preferred)
```

## Implementation Guidelines

### Controller Responsibilities

- **Skinny Controllers**: **Controller delegates to Action or Service classes**; keep controllers focused on mapping requests/responses.
- **Dependency Injection**: Use **constructor DI** to inject services or actions. Laravel resolves these via the **Service Container**.
- **No Logic in Routes**: Always delegate route closures to controllers; don't use raw Closures for logic.

### Business Logic Placement

- **Actions**: Create app/Actions/CreatePost.php (or similar) — one action per use case — with a single `handle()` method. This keeps controllers slim and Create Action class logic focused.
- **Service Classes**: Create app/Services/PaymentService.php for multi-step logic across domains. type-hint interface in controller constructor for clean DI.
- **Binding**: Bind interfaces in **`AppServiceProvider`** using **`$this->app->bind(Interface::class, Implementation::class)`**.
- **Service Isolation**: **No Eloquent queries directly in controllers**; handle database access within services or actions.

### Validation & Requests

- **Form Requests**: Use `php artisan make:request StoreUserRequest` for Form Requests for validation.
- **Usage**: call $request->validated() in the controller or action for mass assignment.
- **Validation Methods**: Implement **`authorize()`** and **`rules()`**; never use `$request->validate()` inline.

## Anti-Patterns

- **No logic in Controllers**: Move to Services or Action classes.
- **No manual instantiation**: Use Service Container via DI.
- **No inline `$request->validate()`**: Favor Form Request classes.
- **No excessive global helpers**: Use class-based logic instead.

## References

- [Slim Controller Patterns](references/implementation.md)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.