cohete / ddd
Opinionated DDD building blocks for Cohete
v0.1.0
2026-03-12 18:14 UTC
Requires
- php: >=8.2
- ramsey/uuid: ^4.7
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
This package is auto-updated.
Last update: 2026-03-18 14:12:37 UTC
README
Opinionated DDD building blocks for Cohete.
Installation
composer require cohete/ddd
Value Objects
- StringValueObject - Base class for string VOs with validation (maxLength, notNull, notEmpty)
- UuidValueObject - UUID v4 via ramsey/uuid
- AtomDateValueObject - Dates in ATOM format
Example: custom Value Object
use Cohete\DDD\ValueObject\StringValueObject; class UserEmail extends StringValueObject { public static function from(?string $value = null): static { static::assertNotNull($value); static::assertNotEmpty($value); static::assertMaxLength(255, $value); if (!filter_var($value, FILTER_VALIDATE_EMAIL)) { throw new \InvalidArgumentException("Invalid email: $value"); } return parent::from($value); } }
License
MIT