{"id":24011913,"url":"https://github.com/phauthentic/domain-events-symfony-bundle","last_synced_at":"2026-05-17T05:38:32.284Z","repository":{"id":271390016,"uuid":"909658054","full_name":"Phauthentic/domain-events-symfony-bundle","owner":"Phauthentic","description":"A simple, non-intrusive way to extract domain events from aggregates in Symfony.","archived":false,"fork":false,"pushed_at":"2025-01-07T11:45:00.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-07T12:35:03.267Z","etag":null,"topics":["domain-events","event-driven","event-driven-architecture","events","symfony","symfony-bundle"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Phauthentic.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-29T12:01:00.000Z","updated_at":"2025-01-07T11:45:04.000Z","dependencies_parsed_at":"2025-01-07T12:36:46.504Z","dependency_job_id":"0af28b5d-86bd-4b97-8ba9-1049bc84148c","html_url":"https://github.com/Phauthentic/domain-events-symfony-bundle","commit_stats":null,"previous_names":["phauthentic/domain-events-symfony-bundle"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phauthentic%2Fdomain-events-symfony-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phauthentic%2Fdomain-events-symfony-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phauthentic%2Fdomain-events-symfony-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phauthentic%2Fdomain-events-symfony-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Phauthentic","download_url":"https://codeload.github.com/Phauthentic/domain-events-symfony-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232982678,"owners_count":18606441,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["domain-events","event-driven","event-driven-architecture","events","symfony","symfony-bundle"],"created_at":"2025-01-08T05:42:43.398Z","updated_at":"2026-05-17T05:38:32.248Z","avatar_url":"https://github.com/Phauthentic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Symfony Domain Events Bundle\n\nThis bundle deals with the dispatching of domain events and the implementation of the outbox pattern, which is optional.\n\nThe outbox pattern is a way to ensure reliable message publishing with a dedicated “Outbox” table within your transactional boundary. It is suited to scenarios needing atomic writes to business data and events. It is simple to implement using existing relational databases.\n\nThis library follows the KISS principle and tries to keep things as simple and easy to understand as possible. Being framework agnostic was never a design goal, nor being super generic.\n\n## Features\n\n* Domain events dispatching\n* (Optional) Outbox pattern implementation\n\n## Installation\n\n```bash\ncomposer require phauthentic/domain-events-symfony-bundle\n```\n\nWire the services in your `config/services.yaml`:\n\n```yaml\nservices:\n    Phauthentic\\Symfony\\DomainEvents\\Domain\\ReflectionAggregateExtractor:\n    Phauthentic\\Symfony\\DomainEvents\\Domain\\AggregateExtractorInterface: '@Phauthentic\\Symfony\\DomainEvents\\Domain\\ReflectionAggregateExtractor'\n    Phauthentic\\Symfony\\DomainEvents\\Doctrine\\DomainEventEmitter:\n      tags:\n        - { name: 'doctrine.event_listener', event: 'postPersist', priority: 1 }\n```\n\n## Usage\n\nAdd the `#[AggregateRoot]` attribute to your aggregate root classes that should emit domain events. By default the AggregateRoot attribute will look for an `id` and `domainEvents` property in your aggregate root classes. You can customize this by passing the property names as arguments to the attribute.\n\nOptional: Use the EventRecorderTrait in your aggregate root classes to record domain events if you want to stick to the defaults. The trait implements the `domainEvents` property and adds a method `recordThat(object $event)`.\n\n### Minimum default example\n\n```php\n#[AggregateRoot]\nclass Cart {\n\n    use EventRecorderTrait;\n\n    string $id;\n    \n    public function itemAdded(Item $item) {\n        $this-\u003eitems[] = $item;\n        $this-\u003erecordThat(new ItemAdded($item));\n    }\n}\n```\n\n## Domain Events, the Outbox Pattern and Event Sourcing\n\nThe bundle is intentionally not implementing event sourcing, because it adds another level of often not needed complexity. If you struggle to understand this design decision you are probably not a candidate for event sourcing in any case.\n\n### The Outbox Pattern\n\n- Ensures reliable message publishing with a dedicated “Outbox” table within your transactional boundary.\n- Suited to scenarios needing atomic writes to business data and events.\n- Simple to implement using existing relational databases.\n\n### Event Store / Event Sourcing\n\n- Stores **every** event as the system’s ultimate source of truth.\n- Suited to event-sourced architectures, allowing system state to be rebuilt from event history.\n- Provides full auditability and traceability but is **more complex**.\n\n#### Event Sourcing Alternatives\n\n- [Phauthentic Event Sourcing](https://github.com/Phauthentic/event-sourcing)\n- [Ecotone Framework](https://docs.ecotone.tech/)\n- [Event Sauce](https://eventsauce.io/)\n- [Broadway](https://github.com/broadway/broadway)\n\n## License\n\nThis bundle is under the MIT license.\n\nCopyright Florian Krämer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphauthentic%2Fdomain-events-symfony-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphauthentic%2Fdomain-events-symfony-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphauthentic%2Fdomain-events-symfony-bundle/lists"}