Download the PHP package geekcell/ddd-bundle without Composer
On this page you can find all versions of the php package geekcell/ddd-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download geekcell/ddd-bundle
More information about geekcell/ddd-bundle
Files in geekcell/ddd-bundle
Package ddd-bundle
Short Description A bundle for pragmatic domain driven design in Symfony.
License MIT
Informations about the package ddd-bundle
Symfony Bundle for DDD
This Symfony bundle augments geekcell/php-ddd with framework-specific implementations to enable seamless domain driven design in a familiar environment.
- Installation
- Generator Commands
- Building Blocks
- Model & Repository
- AggregateRoot & Domain Events
- Command & Query
- Controller
- Resource
Installation
To use this bundle, require it in Composer
Generator Commands
This bundle adds several MakerBundle commands to generate commonly used components.
In order to use them in your Symfony project, you need to require it with composer first
Available Commands
Building Blocks
Model & Repository
The domain model is a representation of the domain concepts and business logic within your project. The repository on the other hand is an abstraction layer that provides a way to access and manipulate domain objects without exposing the details of the underlying data persistence mechanism (such as a database or file system).
Since Doctrine is the de-facto persistence layer for Symfony, this bundle also provides an (opinionated) implementation for a Doctrine-based repository.
Generator Command(s)
This command can be used to generate:
- The domain model class.
- A repository class for the model.
- The model's identity class as value object (optional).
- A Doctrine database entity configuration, either as annotation or separate config file (optional).
- A custom Doctrine type for the model's identity class (optional).
AggregateRoot & Domain Events
Optionally, by inheriting from AggregateRoot
, you can make a model class an aggregate root, which is used to encapsulate a group of related objects, along with the behavior and rules that apply to them. The aggregate root is usually responsible for managing the lifecycle of the objects within the aggregate, and for coordinating any interactions between them.
The AggregateRoot
base class comes with some useful functionality to record and dispatch domain events, which represent significant occurrences or state changes within the domain of a software system.
Generator Command(s)
N/A
Example Usage
Hint: If you want to dispatch an event directly, use AggregateRoot::dispatch()
instead of AggregateRoot::record()
.
If you cannot (or don't want to) extend from AggregateRoot
, you can alternative use DispatchableTrait
to add dispatching capabilities to any class. The former is however the recommended way.
Command & Query
You can use CommandBus
and QueryBus
as services to implement CQRS. Internally, both buses will use the Symfony messenger to dispatch commands and queries.
Generator Command(s)
These commands can be used to generate:
- A command and command handler class.
- A query and query handler class.
The query / command generated is just an empty class. The handler class is registered as a message handler for the configured Symfony Messenger.
Example Usage
Controller
A standard Symfony controller, but augmented with command and query bus(es).
Generator Command
This command can be used to generate a controller with optional QueryBus
and CommandBus
dependencies.
Resource
An API Platform resource, but instead of using the standard approach of using a combined entity/resource approach, it is preferred to separate model (domain layer) and API Platform specific resource (infrastructure layer)
Generator Command
Minimum required API Platform version is 2.7 for the new metadata system.
All versions of ddd-bundle with dependencies
geekcell/container-facade Version ^1.0
geekcell/ddd Version ^1.1.0
symfony/config Version ^6.0 | ^7.0
symfony/dependency-injection Version ^6.0 | ^7.0
symfony/event-dispatcher Version ^6.0 | ^7.0
symfony/http-kernel Version ^6.0 | ^7.0
symfony/messenger Version ^6.0 | ^7.0
symfony/string Version ^6.0 | ^7.0