brdd / brdd-php
Business Rule Driven Design (BRDD) core interfaces and contexts for PHP.
dev-main
2026-05-02 03:22 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2026-05-02 03:28:43 UTC
README
This repository contains the official Business Rule Driven Design (BRDD) interfaces and contexts tailored for PHP 8.1+. It enforces strict architectural boundaries, ensuring that orchestrators, validation engines, and side effects remain decoupled.
🚀 Installation
composer require brdd/brdd-php
🛠Basic Usage Example
use Brdd\Contracts\UseCase; use Brdd\Contexts\ExecutionContext; class SubmitAssignmentUseCase implements UseCase { // Inject services via constructor... public function execute($input): ExecutionContext { $enrichedData = $this->enrichService->enrich($input); $validationContext = $this->validateService->validate($enrichedData); $context = ExecutionContext::build("US_SUBMIT", $validationContext); if ($validationContext->hasErrors()) { return $context; } $result = $this->businessService->execute($enrichedData); $context->addSetter('SET_ID', $result->id); $context->addEffect(ExecutionContext::POST_EFFECT, 'EFF_NOTIFY', function() use ($result) { $this->clientService->call($result); }); $context->setData($result); return $context; } }
🤖 AI-First Development
Check the AI Guidelines for more details.
📚 Documentation
📄 License
MIT