repository

Implement repository interfaces and infrastructure adapters using Hexagonal architecture in PHP.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/dairectiv/dairectiv --skill repository
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: repository
Source: https://github.com/dairectiv/dairectiv/tree/main/.claude/skills/repository
Command: npx skills add https://github.com/dairectiv/dairectiv --skill repository

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Guides developers to implement repository interfaces and their infrastructure adapters following the Port & Adapters (Hexagonal) architecture.

Core Features & Use Cases

  • Interface-first design for Domain repositories to isolate business logic from data access.
  • Clear separation of concerns between Domain and Infrastructure layers (e.g., Domain\Repository interfaces vs Infrastructure\Doctrine\ORM\Repository implementations).
  • Guidance for naming conventions, placement, and testing strategies to ensure consistent repository behavior across PHP projects.

Quick Start

Plan and implement a new repository by defining its Domain interface, creating a corresponding Infrastructure repository, and adding integration tests to validate persistence flows.

Frequently Asked Questions about repository

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

FAQPage Schema
How do I implement a repository interface using hexagonal architecture in PHP?

To implement a repository interface using hexagonal architecture in PHP, define a Domain repository interface to isolate business logic, then create an Infrastructure adapter to handle data access. This separates concerns between the Domain and Infrastructure layers.

What is the best way to structure Doctrine ORM repositories in a Port and Adapters architecture?

The best way to structure Doctrine ORM repositories in a Port and Adapters architecture is placing interfaces in the Domain layer and concrete Doctrine implementations in the Infrastructure layer. This ensures naming conventions and placement isolate business logic from data access.

How do I add new methods to an existing repository without breaking domain-driven design?

To add methods to an existing repository without breaking domain-driven design, update the Domain repository interface first, then implement the corresponding method in the Infrastructure adapter. Add integration tests to validate the new persistence flow.

Can I use this approach to migrate legacy PHP data access to a hexagonal structure?

Yes, you can migrate legacy PHP data access to a hexagonal structure by defining Domain repository interfaces for existing data access patterns, then creating Infrastructure adapters to maintain current behavior while isolating business logic from data access.

How do I test repository implementations in a PHP hexagonal architecture?

To test repository implementations in a PHP hexagonal architecture, write integration tests that validate the persistence flows of your Infrastructure adapters. This ensures your repository implementations maintain consistent behavior across PHP projects.

Why separate Domain repository interfaces from Infrastructure Doctrine implementations?

Separating Domain repository interfaces from Infrastructure Doctrine implementations isolates business logic from data access. This interface-first design ensures clear separation of concerns, making your PHP application easier to maintain and test.