Generates Bridge pattern for PHP 8.4. Decouples abstraction from implementation. Includes unit tests.
From accnpx claudepluginhub dykyi-roman/awesome-claude-code --plugin accThis skill uses the workspace's default tool permissions.
references/examples.mdreferences/templates.mdCreates Bridge pattern infrastructure for separating abstraction from implementation.
| Scenario | Example |
|---|---|
| Multiple dimensions of variation | Notification types × channels |
| Avoid class explosion | Shape × rendering method |
| Runtime implementation switching | Database drivers |
| Platform independence | UI × OS |
Path: src/Domain/{BoundedContext}/
{Name}ImplementorInterface.php — Low-level operationsPath: src/Domain/{BoundedContext}/
Abstract{Name}.php — High-level interfacePath: src/Domain/{BoundedContext}/
{Type}{Name}.php — Specialized abstractionsPath: src/Infrastructure/{BoundedContext}/
{Platform}{Name}Implementor.php — Platform implementations{ClassName}Test.php — Bridge behavior verification| Component | Path |
|---|---|
| Abstraction | src/Domain/{BoundedContext}/ |
| RefinedAbstraction | src/Domain/{BoundedContext}/ |
| Implementor Interface | src/Domain/{BoundedContext}/ |
| ConcreteImplementor | src/Infrastructure/{BoundedContext}/ |
| Unit Tests | tests/Unit/ |
| Component | Pattern | Example |
|---|---|---|
| Abstraction | Abstract{Name} | AbstractNotification |
| RefinedAbstraction | {Type}{Name} | UrgentNotification |
| Implementor Interface | {Name}ImplementorInterface | NotificationImplementorInterface |
| ConcreteImplementor | {Platform}{Name}Implementor | EmailNotificationImplementor |
abstract readonly class Abstract{Name}
{
public function __construct(
protected {Name}ImplementorInterface $implementor
) {}
abstract public function {operation}({params}): {returnType};
}
final readonly class {Type}{Name} extends Abstract{Name}
{
public function {operation}({params}): {returnType}
{
{preprocessing}
return $this->implementor->{implementorMethod}({params});
}
}
$email = new EmailNotificationImplementor();
$urgent = new UrgentNotification($email);
$urgent->send($message);
// Switch implementation
$sms = new SmsNotificationImplementor();
$urgent = new UrgentNotification($sms);
$urgent->send($message);
| Bridge | Purpose |
|---|---|
| NotificationBridge | Type × Channel (Email/SMS/Push) |
| ReportBridge | Format × Generator (PDF/Excel/CSV) |
| DatabaseBridge | Query × Driver (MySQL/PostgreSQL) |
| PaymentBridge | Gateway × Provider (Stripe/PayPal) |
| Anti-pattern | Problem | Solution |
|---|---|---|
| Missing Abstraction | Direct implementor use | Use abstraction layer |
| Tight Coupling | Abstraction knows concrete implementor | Depend on interface |
| Single Implementation | No variation | Use simple inheritance |
| Leaky Abstraction | Exposes implementor details | Hide implementation |
For complete PHP templates and examples, see:
references/templates.md — Abstraction, refined abstraction, implementor templatesreferences/examples.md — Notification, report bridges with unit testsProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.