andrzejkupczyk/ddd-building-blocks

Domain-Driven Design components implementation

v3.0.0 2021-01-02 13:25 UTC

This package is auto-updated.

Last update: 2024-10-29 04:20:09 UTC


README

PHP requirement GitHub license GitHub tag (latest SemVer)

This repository helps me experiment with the DDD approach.

All implementations are inspired by books, ValueObject library created by Nicolò Pignatelli, SeedStack Java development stack, ValueObjects toolkit and some other, more direct sources, but mainly by my experiences and needs.

Should I use this library?

Although this package can be introduced as a Generic Subdomain to relieve the Core Domain of a project from unnecessary clutter, it has been developed as an example which probably do not reflect 100% your domain. Therefore, you should rather write your own DDD components using interfaces provided by the DDD Generics package to force members of your team or yourself on thinking in terms of immutable objects and their interaction.

Installation

Using Composer:

composer require andrzejkupczyk/ddd-building-blocks

Example usages

<?php

namespace Brunswick\Billiards\Table;

use WebGarden\Model\ValueObject\Number\Natural;

final class Size extends Natural
{
    protected static function validate($feet)
    {
        return parent::validate($feet)->between(7, 9);
    }
}