laravel:ports-and-adapters

Implement Ports and Adapters architecture with PHP interfaces and provider-specific adapters.

1|Updated Sep 22, 2025
One-click install
npx skills add https://github.com/meistro57/chat_bridge --skill laravel-ports-and-adapters
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel:ports-and-adapters
Source: https://github.com/meistro57/chat_bridge/tree/main/.claude/skills/ports-and-adapters
Command: npx skills add https://github.com/meistro57/chat_bridge --skill laravel-ports-and-adapters

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenge of tightly coupling application logic with specific external service SDKs, making the codebase brittle and difficult to test or switch providers.

Core Features & Use Cases

  • Interface Abstraction: Defines clear, application-specific interfaces (ports) for external interactions.
  • Provider Adapters: Creates separate adapters for each external service provider, encapsulating SDK-specific logic.
  • Composition Root Selection: Allows choosing the appropriate adapter at the application's composition root (e.g., service providers) based on configuration.
  • Use Case: Ensure your application can seamlessly switch between different email sending services (e.g., SES, SendGrid, SMTP) without altering core business logic by abstracting the MailPort.

Quick Start

Configure your application to use the SES adapter for the MailPort.

Frequently Asked Questions about laravel:ports-and-adapters

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

FAQPage Schema
How do I decouple Laravel application logic from external service SDKs?

To decouple Laravel application logic from external service SDKs, implement the Ports and Adapters pattern by defining PHP interfaces for application needs and creating provider-specific adapters that encapsulate SDK quirks. This enables adapter selection at the composition edge via configuration.

What is the Ports and Adapters architecture pattern in PHP?

The Ports and Adapters architecture pattern in PHP abstracts external system integrations by defining application-specific interfaces (ports) and creating provider-specific adapters that wrap SDK quirks, allowing adapter selection at the composition root based on configuration.

How do I switch between different email sending services in Laravel without altering core business logic?

Switch between different email sending services in Laravel without altering core business logic by abstracting the MailPort interface. Create separate adapters for each provider like SES, SendGrid, or SMTP, and select the appropriate adapter at the service provider composition root via configuration.

Can I use service providers to select adapters at the composition root in Laravel?

Yes, you can use service providers to select adapters at the composition root in Laravel. The Ports and Adapters pattern allows choosing the appropriate provider-specific adapter based on application configuration, enabling seamless switching between external service implementations.

When should I use hexagonal architecture to abstract external integrations?

Use hexagonal architecture to abstract external integrations when your codebase is tightly coupled to specific external service SDKs, making it brittle and difficult to test or switch providers. Defining clear PHP interfaces for ports solves this by encapsulating SDK-specific logic in adapters.