Generates Facade pattern for PHP 8.4. Creates simplified interface to complex subsystems. 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 Facade pattern infrastructure for providing simplified access to complex subsystems.
| Scenario | Example |
|---|---|
| Complex subsystem simplification | Order facade combining inventory, payment, shipping |
| Multiple service orchestration | Notification facade coordinating email, SMS, push |
| Legacy system wrapping | Facade hiding complex legacy APIs |
| Layered system access | Application layer facade for domain services |
Path: src/Application/{BoundedContext}/Facade/
{Name}Facade.php — Unified interface to subsystemPaths: Domain or Infrastructure services
{FacadeName}Test.php — Facade orchestration verification| Component | Path |
|---|---|
| Facade | src/Application/{BoundedContext}/Facade/ |
| Subsystem Classes | src/Domain/ or src/Infrastructure/ |
| Unit Tests | tests/Unit/Application/{BoundedContext}/Facade/ |
| Component | Pattern | Example |
|---|---|---|
| Facade | {Name}Facade | OrderFacade |
| Test | {ClassName}Test | OrderFacadeTest |
final readonly class {Name}Facade
{
public function __construct(
private {SubsystemA} $subsystemA,
private {SubsystemB} $subsystemB,
private {SubsystemC} $subsystemC
) {}
public function {complexOperation}({params}): {returnType}
{
$stepA = $this->subsystemA->{methodA}({params});
$stepB = $this->subsystemB->{methodB}($stepA);
$stepC = $this->subsystemC->{methodC}($stepB);
return $stepC;
}
}
// Without facade - complex coordination
$inventory = $inventoryService->reserve($productId, $quantity);
$payment = $paymentService->charge($amount, $token);
$shipment = $shippingService->schedule($address, $inventory);
$order = $orderRepository->save(new Order(...));
$notificationService->sendConfirmation($order);
// With facade - simple call
$order = $orderFacade->placeOrder($command);
| Facade | Purpose |
|---|---|
| OrderFacade | Coordinate inventory, payment, shipping, notifications |
| NotificationFacade | Send via email, SMS, push, Slack |
| ReportFacade | Generate PDF, Excel, CSV reports |
| UserRegistrationFacade | Validate, create account, send welcome email |
| PaymentFacade | Authorize, charge, record, notify |
| ExportFacade | Fetch data, transform, format, save file |
| Anti-pattern | Problem | Solution |
|---|---|---|
| God Facade | Facade does too much | Split into focused facades |
| Business Logic in Facade | Facade makes decisions | Move logic to domain services |
| Tight Coupling | Facade depends on concrete classes | Inject interfaces |
| No Subsystem Access | Clients can't bypass facade | Allow direct subsystem use |
| Stateful Facade | Facade holds state between calls | Keep facades stateless |
For complete PHP templates and examples, see:
references/templates.md — Facade templates for order, notification, report systemsreferences/examples.md — OrderFacade, NotificationFacade, ReportFacade 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.