laravel-knowledge

Laravel framework knowledge base. Covers topics such as architecture design, domain-driven design (DDD) integration, Eloquent persistence, service container, security, queues, events, infrastructure components, testing, and common anti-patterns in Laravel PHP projects.

Last repository push
GitHub Stars
109
Forks
26
Issues / PRs
1

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "laravel-knowledge" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2036c581635a652a62c50abff5c69647f9efea54836203582aa501cbb476c657. Verify the upstream source and version against https://github.com/dykyi-roman/awesome-claude-code before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Laravel framework knowledge base. Covers topics such as architecture design, domain-driven design (DDD) integration, Eloquent persistence, service container, security, queues, events, infrastructure components, testing, and common anti-patterns in Laravel PHP projects.

0 Downloads

Introduction source: third_party · dykyi-roman · 0.0.1 Reference

SkillPi interpretation

Tasks
Laravel framework knowledge base. Provides architecture, DDD integration, Eloquent persistence, service container, security, queues, events, infrastructure components, testing, and antipatterns for Laravel PHP projects.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: laravel-knowledge
description: Laravel framework knowledge base. Provides architecture, DDD integration, Eloquent persistence, service container, security, queues, events, infrastructure components, testing, and antipatterns for Laravel PHP projects.

Laravel Knowledge Base

Quick reference for Laravel framework patterns, DDD integration strategies, and PHP 8.4 best practices for building scalable Laravel applications.

Core Principles

Service Providers

Service Providers are the central place to configure and bootstrap the application. All bindings, event listeners, middleware, and routes are registered through providers.

Facades

Facades provide a static-like interface to classes in the service container. Prefer dependency injection over Facades in Domain and Application layers; Facades are acceptable in Presentation and Infrastructure layers.

Directory Structure

Default Laravel:                DDD-Aligned Laravel:
app/                            app/
├── Http/Controllers/           src/
├── Models/                     ├── Domain/
├── Providers/                  │   ├── Order/
├── Services/                   │   │   ├── Entity/
├── Events/                     │   │   ├── ValueObject/
├── Listeners/                  │   │   ├── Repository/
├── Jobs/                       │   │   └── Event/
├── Mail/                       │   └── Customer/
└── Exceptions/                 ├── Application/
                                │   ├── Order/UseCase/
                                │   └── Customer/UseCase/
                                └── Infrastructure/
                                    ├── Persistence/
                                    ├── Http/
                                    └── Provider/

Quick Checklists

DDD-Compatible Laravel Project

  • [ ] Domain layer has zero Laravel imports
  • [ ] Eloquent Models live in Infrastructure, not Domain
  • [ ] Repository interfaces in Domain, Eloquent implementations in Infrastructure
  • [ ] Service Providers wire interfaces to implementations
  • [ ] Domain Events decoupled from Laravel Event system
  • [ ] Value Objects used instead of primitive types
  • [ ] Controllers are thin, delegate to Use Cases
  • [ ] Authorization uses Policies delegating to domain Specifications
  • [ ] Queued jobs have retry strategy, failed() method, and concurrency protection
  • [ ] Domain defines its own EventDispatcherInterface (not Laravel Event facade)
  • [ ] Infrastructure components (Cache, HTTP Client) accessed via domain ports

Clean Architecture Checks

  • [ ] No use Illuminate\... in Domain layer
  • [ ] No business logic in Controllers or Middleware
  • [ ] FormRequest used for input validation
  • [ ] API Resources used for response transformation
  • [ ] Single-action controllers for complex endpoints
  • [ ] No direct DB queries in Controllers

Common Violations Quick Reference

Violation Where to Look Severity
Eloquent in Domain layer use Illuminate\Database in Domain/ Critical
Business logic in Controller if/switch on domain state in Controllers Critical
Fat Eloquent Model Model with 500+ lines, business methods Critical
Facade in Domain use Illuminate\Support\Facades in Domain/ Critical
Missing FormRequest Raw $request->input() with inline validation Warning
N+1 query Relationship access in loops without eager loading Warning
Missing API Resource Array building in Controller for responses Warning
Direct DB in Controller DB::table() or Model::where() in Controller Warning
Business logic in Policy DB queries or complex logic in Policy class Warning
Missing job retry strategy ShouldQueue without $tries or backoff() Warning
Event facade in Domain Event::dispatch() or event() in Domain layer Critical
Cache/HTTP in Domain Cache:: or Http:: in Domain layer Critical

PHP 8.4 Laravel Patterns

Single-Action Controller

<?php

declare(strict_types=1);

namespace App\Http\Controllers\Order;

use App\Application\Order\UseCase\CreateOrderUseCase;
use App\Http\Requests\Order\CreateOrderRequest;
use App\Http\Resources\Order\OrderResource;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;

final readonly class CreateOrderController
{
    public function __construct(
        private CreateOrderUseCase $createOrder,
    ) {}

    public function __invoke(CreateOrderRequest $request): JsonResponse
    {
        $orderId = $this->createOrder->execute($request->toCommand());

        return OrderResource::make($orderId)
            ->response()
            ->setStatusCode(Response::HTTP_CREATED);
    }
}

FormRequest

<?php

declare(strict_types=1);

namespace App\Http\Requests\Order;

use App\Application\Order\Command\CreateOrderCommand;
use App\Domain\Order\ValueObject\CustomerId;
use Illuminate\Foundation\Http\FormRequest;

final class CreateOrderRequest extends FormRequest
{
    /** @return array<string, mixed> */
    public function rules(): array
    {
        return [
            'customer_id' => ['required', 'uuid'],
            'lines' => ['required', 'array', 'min:1'],
            'lines.*.product_id' => ['required', 'uuid'],
            'lines.*.quantity' => ['required', 'integer', 'min:1'],
        ];
    }

    public function toCommand(): CreateOrderCommand
    {
        return new CreateOrderCommand(
            customerId: new CustomerId($this->validated('customer_id')),
            lines: $this->validated('lines'),
        );
    }
}

Application Service (Use Case)

<?php

declare(strict_types=1);

namespace App\Application\Order\UseCase;

use App\Domain\Order\Entity\Order;
use App\Domain\Order\Repository\OrderRepositoryInterface;
use App\Domain\Order\ValueObject\OrderId;

final readonly class CreateOrderUseCase
{
    public function __construct(
        private OrderRepositoryInterface $orders,
    ) {}

    public function execute(CreateOrderCommand $command): OrderId
    {
        $order = Order::create(
            id: OrderId::generate(),
            customerId: $command->customerId,
            lines: $command->lines,
        );

        $this->orders->save($order);

        return $order->id();
    }
}

References

For detailed information, load these reference files:

  • references/architecture.md -- Service Providers, Facades, directory structure, module patterns
  • references/ddd-integration.md -- Extracting Domain from app/, Eloquent separation, Domain Events
  • references/routing-http.md -- Controllers, middleware, FormRequest, API Resources, policies
  • references/persistence.md -- Eloquent ORM, migrations, transactions, read/write splitting
  • references/dependency-injection.md -- Service Container, contextual binding, interface binding
  • references/testing.md -- Feature/Unit tests, Pest, factories, mocking, database testing
  • references/security.md -- Gates, Policies with Specifications, password hashing, Sanctum, User model separation
  • references/queues-advanced.md -- Job middleware, batching, chaining, retry/DLQ, Horizon, unique jobs, CQRS
  • references/event-system.md -- Event discovery, queued listeners, subscribers, domain event bridge, testing
  • references/infrastructure-components.md -- Cache, HTTP Client, Rate Limiting, Task Scheduling, Locks with DDD ports
  • references/antipatterns.md -- God Model, fat controller, Facade abuse, N+1 detection

Current listing version

0.0.1

Verify the source revision ↗

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 提供 Laravel 框架知识库,涵盖架构设计、DDD 集成、Eloquent 持久化、服务容器、安全性、队列、事件、基础设施组件、测试及反模式等内容
  • 适用于 Laravel 开发者日常开发参考,具有广泛受众的实用能力
Trigger Precision95/100

Highlights

  • description 明确描述了 Skill 的核心功能(Laravel 框架知识库),触发词精准完整,边界清晰
Structure and Standards92/100

Highlights

  • 文档结构清晰,包含 Core Principles、Quick Checklists、Common Violations Quick Reference、PHP 8.4 Laravel Patterns 等章节
  • 有具体代码示例和目录结构对比,frontmatter 完整,单文件未超过 500 行
Execution Reliability88/100

Highlights

  • Skill 为知识库类型,内容来源明确(Laravel 官方最佳实践),参数和示例正确
  • 覆盖主要异常场景(如 N+1 查询、Facade 滥用等)
Evidence Verifiability (mean of the first four)88/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.