brdd/brdd-php

Business Rule Driven Design (BRDD) core interfaces and contexts for PHP.

Maintainers

Package info

github.com/brdd-design/brdd-php

pkg:composer/brdd/brdd-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-05-02 03:22 UTC

This package is auto-updated.

Last update: 2026-05-02 03:28:43 UTC


README

Packagist Version

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