skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
garrettw/php-arch-skills47 installs

framework-integration

Use this skill when applying clean-architecture, DDD, or hexagonal patterns inside a specific PHP framework. Provides framework-specific port mapping, adapter patterns, and pitfalls to avoid for Laravel, Symfony, Slim, CakePHP, CodeIgniter, Yii, Laminas, Mezzio, Zend Framework, and legacy/maintenance-mode frameworks. Triggers when a framework is named or when clean-architecture principles need framework-specific wiring guidance.

How do I install this agent skill?

npx skills add https://github.com/garrettw/php-arch-skills --skill framework-integration
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides architectural guidance and reference material for integrating various PHP frameworks with clean architecture and Domain-Driven Design (DDD) principles. It contains no executable code or malicious patterns.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

Framework Integration for Clean Architecture & DDD

This skill assumes familiarity with the framework-agnostic skills (php-domain-modeling, application-layer, infrastructure-boundaries, etc.). It provides framework-specific mappings for ports, adapters, DI wiring, and common anti-patterns.

Note that not every feature needs full DDD wiring. The php-domain-modeling skill defines lighter defaults — a Transaction Script (one procedure per request) or a Table Module (one class per table operating on a recordset) — for simple or data-centric features. This skill still applies to those patterns: keep the framework controller thin and delegate to the script/module, and keep the framework ORM in an adapter rather than treating it as the domain. Reach for the full DDD port/adapter wiring below only when the feature's rules justify it.

When to Apply This Guidance

Use this skill when the project already decided which framework to use and needs to apply clean architecture patterns within that framework. Do not use it to choose a framework.

Available References

CategoryFrameworkReference File
ModernLaravelreferences/laravel.md
ModernSymfonyreferences/symfony.md
ModernSlimreferences/slim.md
ModernCakePHP 5.xreferences/cakephp-5.md
ModernCodeIgniter 4references/codeigniter-4.md
ModernYii 3references/yii-3.md
ModernLaminasreferences/laminas.md
ModernMezzioreferences/mezzio.md
LegacyZend Framework 1references/zend-framework-1.md
LegacyZend Framework 2references/zend-framework-2.md
LegacyCakePHP 2.xreferences/cakephp-2.md
LegacyCakePHP 3.x/4.xreferences/cakephp-3-4.md
LegacyYii 1.1references/yii-1.md
LegacyYii 2references/yii-2.md
LegacyCodeIgniter 3references/codeigniter-3.md

Read the relevant reference file for framework-specific anti-patterns and guidance. The mapping table below applies across all frameworks.

Port-to-Framework Mapping

ConceptLaravelSymfonySlimCakePHP 3.x/4.xCakePHP 5.xCodeIgniter 4Yii 2Yii 3LaminasMezzio
Driver EntryRoute -> Controller -> HandlerController -> HandlerRoute -> Callable -> HandlerController/Table -> HandlerController/Command -> HandlerController -> HandlerController -> HandlerRoute -> HandlerController -> HandlerMiddleware -> Handler
Repository PortInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/DomainInterface in [Context]/Domain
Repository AdapterEloquent in [Context]/Infrastructure/PersistenceDoctrine in [Context]/Infrastructure/PersistencePDO/ORM in [Context]/Infrastructure/PersistenceTable in [Context]/Infrastructure/PersistenceTable in [Context]/Infrastructure/PersistenceModel in [Context]/Infrastructure/PersistenceActiveRecord in [Context]/Infrastructure/PersistenceActiveRecord, Cycle ORM, or another ORM in [Context]/Infrastructure/PersistenceTableGateway in [Context]/Infrastructure/PersistenceLaminas Db in [Context]/Infrastructure/Persistence
DI Composition RootAppServiceProvider / singleton()services.yaml / config/services.phpCustom factory or foreach bindsrc/Application.php or bootstrap.phpsrc/Application.php or bootstrap.phpapp/Config/Services.phpconfig/web.php / DI containerconfig/common/di/*.phpModule config + DIconfig/autoload/dependencies.global.php
In-process Events (best-effort, one context)Laravel EventsSymfony EventDispatcherAny PSR-14 dispatcher (e.g., league/event)CakePHP EventManagerCakePHP EventManagerCodeIgniter\Events\EventsYii EventPSR-14 dispatcher (yiisoft/event-dispatcher)Laminas EventManagerLaminas EventManager
Reliable Publishing (outbox relay)Relay command dispatching queued jobsRelay publishing through MessengerRelay worker + broker clientRelay shell/command + queue pluginRelay command + cakephp/queueRelay spark command + queue libraryRelay console command + yii2-queueRelay command + yiisoft/queueRelay worker + broker clientRelay worker + broker client

Repository Port rows apply where an area uses ports and adapters. Lean areas inject the concrete repository.

The in-process event row is only for best-effort reactions inside one context, where losing an event is harmless. Events that must not be lost, or that cross contexts, are written to the outbox in the handler's transaction; a relay publishes them after commit through the mechanism in the Reliable Publishing row (see domain-events, workflow 3, and reliable-messaging). Never dispatch them from the handler before or instead of the commit.

Boundaries

Always Do

  • Always keep framework-specific objects (Request, Eloquent Model, AR Entity, Table) in driver/driven adapters.
  • Always register adapter-to-port bindings in a single composition root.
  • Always write domain logic in plain PHP classes with zero framework dependencies.
  • Always convert framework request/response objects to domain-neutral DTOs at the boundary.

Ask First

  • Ask before using a framework's built-in "magic" (Facades, Service Locators, Gii, Behaviors) in a new codebase. Is there a cleaner explicit alternative?
  • Ask before deciding to fight the framework's conventions if the project is small and short-lived. Sometimes the convention is the right trade-off. For simple or data-centric features, prefer a Transaction Script or Table Module over either full DDD wiring or dumping logic in the controller.

Never Do

  • Never import framework base classes, facades, or static service locators into domain or application code.
  • Never use framework-specific exceptions or response objects as return types from handlers.
  • In an area with a rich domain model, never treat an Active Record model (Eloquent, CakePHP Table/Entity, Yii ActiveRecord) as your aggregate root; it is an adapter, not the domain. In lean CRUD areas, using the model directly is the intended choice (see php-domain-modeling). A Data Mapper ORM entity (Doctrine, etc.) may serve as the aggregate if its mapping stays outside the domain logic and its invariants live in its own methods. See symfony.md.
  • Never assume that "the framework does it" is a reason to skip clean-architecture boundaries in a complex, long-lived application.
  • Never put business logic directly in a framework controller, even for lighter patterns. Delegate to a Transaction Script or Table Module and keep the controller as a thin adapter.

For the web/HTTP layer specifically — how the framework "controller" maps onto Action-Domain-Responder, and how to extract a true Responder that owns the whole HTTP response — see the action-domain-responder skill and its action-domain-responder-by-framework.md guide.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/garrettw/php-arch-skills/framework-integration">View framework-integration on skillZs</a>