backend-patterns-php

Architect PHP 8.4+ backend APIs with domain patterns and middleware conventions.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/TrollHeap/dotfiles --skill backend-patterns-php
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-patterns-php
Source: https://github.com/TrollHeap/dotfiles/tree/main/ai-config/.claude/templates/php-native/.claude/skills/backend-patterns-php
Command: npx skills add https://github.com/TrollHeap/dotfiles --skill backend-patterns-php

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers building PHP 8.4+ backend APIs with minimal frameworks, offering architecture decisions, domain patterns, and middleware conventions to deliver maintainable, scalable services.

Core Features & Use Cases

  • Structured project layout for controllers, domain, infra, and middleware.
  • Library choices and wiring guidelines for HTTP, routing, DI, DB, JWT, caching, queues, and rate limiting.
  • Real-world usage patterns: immutable entities, DTOs with validation, repository interfaces, secure filtering, and a robust middleware pipeline.

Quick Start

Set up a PHP 8.4+ project with the recommended project structure, bootstrap services, and run the middleware pipeline to start serving HTTP requests.

Frequently Asked Questions about backend-patterns-php

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

FAQPage Schema
How do I architect a PHP backend API without using a full framework?

Architect PHP backend APIs without a full framework by applying a reusable blueprint with structured project layouts, explicit repository interfaces, and deterministic bootstrap wiring to ensure maintainable domain patterns.

What domain patterns should I use for structuring controllers, services, and infrastructure in PHP?

Use immutable entities, DTOs with safe validation, and explicit repository interfaces to structure controllers, services, and infrastructure, ensuring strict separation between domain logic and infrastructure layers.

How do I set up a middleware pipeline for PHP 8.4+ backend applications?

Set up a PHP 8.4+ middleware pipeline by configuring a pragmatic sequence of middleware conventions that process HTTP requests deterministically before routing them to controllers within the bootstrap wiring.

Can I build scalable PHP APIs using minimal libraries instead of a monolithic framework?

Yes, you can build scalable PHP APIs using minimal libraries by following specific wiring guidelines for HTTP, routing, DI, DB, JWT, caching, queues, and rate limiting instead of adopting a monolithic framework.

What is the best way to organize a PHP project layout for domain-driven design?

Organize a PHP project layout for domain-driven design by creating distinct directories for controllers, domain logic, infrastructure, and middleware to enforce clean boundaries and maintainable code.

Does this PHP architecture approach enforce immutable entities and DTO validation?

Yes, this PHP architecture approach enforces immutable entities and DTO validation, providing safe data handling and robust domain rules through explicit repository interfaces and deterministic bootstrap wiring.