agentleFS
TheBeardedBearSASTheBeardedBearSAS/claude-craft/.claude/references/laravel/CLAUDE.md

claude-craft / laravel

CLAUDE.md108 starsChanged 6 days agoMITView on GitHub

Version : Laravel 13.x (série 13 lancée le 17 mars 2026 — dernière version vérifiée : 13.42.0 au 2026-11-11) PHP : 8.3+ (8.5 recommandé) Sources : https://laravel.com/docs/13.x/releases Laravel 13 recommande Clean Architecture avec le pattern Actions :

The file

Files
CLAUDE.md

Laravel 13 — Framework Reference

Version : Laravel 13.x (série 13 lancée le 17 mars 2026 — dernière version vérifiée : 13.42.0 au 2026-11-11) PHP : 8.3+ (8.5 recommandé) Sources : https://laravel.com/docs/13.x/releases


Table des Matières

FichierSujet
@architecture.mdClean Architecture, Actions, DTOs, Repositories
@coding-standards.mdPHP 8.3+ (8.5 recommandé), Conventions Laravel, Enums, Match
@testing.mdPest 5 + Mutation Testing, Arch Presets
@quality-tools.mdPHPStan 2.0 Level 10, Pint, Rector
@security.mdOWASP Top 10, Sanctum, Passkey Auth
@project-context.mdTemplate contexte projet
@tooling.mdArtisan, Docker, CI/CD, LSP
@laravel13-features.mdAI SDK, Vector Search, Passkey, Team Management

Nouveautés Laravel 13

AI SDK Stable

  • Package laravel/ai (composer require laravel/ai) : API unifiée OpenAI, Anthropic, Gemini + driver openai-compatible
  • Outils (Tools), Agents, Embeddings, Streaming
  • https://laravel.com/docs/13.x/ai-sdk

Vector Search Natif

Passkey Authentication

Pest 5 Mutation Testing

Arch Presets

Team Management Amélioré


Stack Technologique

ComposantVersionDescription
PHP8.3+ (8.5 recommandé)Constructor promotion, readonly, enums, match
Laravel13.xFramework fullstack avec AI SDK
Pest5.x (PHP 8.4+)Tests + Mutation Testing
PHPStan2.0 Level 10Analyse statique stricte
Pint1.xFormatage PSR-12 / Laravel
Sanctum4.xAPI Token Authentication + Passkey
PostgreSQL16+Base de données avec pgvector
Redis7+Cache et Queue

Architecture

Laravel 13 recommande Clean Architecture avec le pattern Actions :

app/
├── Domain/              # Logique métier pure (Models, ValueObjects, Events, Contracts)
├── Application/         # Use cases (Actions, DTOs, Handlers)
├── Infrastructure/      # Implémentations externes (Repositories, Services)
└── Http/                # Présentation (Controllers, Requests, Resources)

Principes

  • Actions : une Action = une opération métier
  • DTOs readonly : typage strict PHP 8.3+
  • Form Requests : validation externalisée
  • API Resources : transformation des réponses
  • Policies : autorisation déclarative
  • Events/Listeners : découplage des effets secondaires

Patterns Essentiels

1. Action Pattern

final readonly class CreateUser
{
    public function __construct(
        private readonly UserRepository $users,
    ) {}

    public function handle(CreateUserDTO $dto): User
    {
        $user = $this->users->create($dto);
        event(new UserRegistered($user));
        return $user;
    }
}

2. DTO Pattern

final readonly class CreateUserDTO
{
    public function __construct(
        public string $name,
        public string $email,
    ) {}
}

3. Repository Pattern

interface UserRepositoryInterface
{
    public function find(int $id): ?User;
    public function create(CreateUserDTO $dto): User;
}

4. AI SDK Pattern (Laravel 13)

use function Laravel\Ai\{agent};

$response = agent(instructions: 'You are a helpful assistant.')
    ->prompt('Hello');

echo (string) $response;

5. Vector Search Pattern (Laravel 13)

$relevantDocs = Document::query()
    ->whereVectorSimilarTo('embedding', $question, minSimilarity: 0.4)
    ->limit(3)
    ->get();

Tests

Pest 5 avec Mutation Testing

# Tests classiques
php artisan test --coverage --min=80

# Mutation Testing (Pest 5)
./vendor/bin/pest --mutate --min=80

Architecture Tests avec Presets

use Pest\Arch\Preset;

uses(Preset::laravel());

arch('Actions are final')->expect('App\Actions')->toBeFinal();

Qualité Code

PHPStan 2.0 Level 10

parameters:
    level: 10
    paths: [app, database, tests]

Pint (Formatage)

./vendor/bin/pint
./vendor/bin/pint --test

Sécurité

OWASP Top 10

  • Sanctum pour API tokens
  • Passkey pour authentification sans mot de passe (Laravel 13)
  • Policies pour autorisation
  • Form Requests pour validation
  • Rate limiting, CSRF, XSS, SQL injection protection

Passkey Auth (Laravel 13)

// config/fortify.php
'features' => [
    Features::passkeys(),  // Nouveauté Laravel 13
],

Checklist Laravel 13

  • Clean Architecture (Domain/Application/Infrastructure/Http)
  • Actions pour logique métier
  • DTOs readonly PHP 8.3+
  • Form Requests + Policies
  • PHPStan Level 10 (PHPStan 2.0)
  • Pest 5 + Mutation Testing >= 80%
  • Arch Presets Laravel appliqués
  • AI SDK configuré (si LLM)
  • Vector Search / pgvector (si RAG)
  • Passkey Authentication (si auth sans mot de passe)
  • Team Management (si Jetstream)

Version : 1.0 Dernière mise à jour : 2026-04 Auteur : The Bearded CTO

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.