Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Ddd Doctrine Bridge

Ddd Doctrine Bridge Laravel Package

becklyn/ddd-doctrine-bridge

Doctrine ORM bridge for becklyn/ddd-core: provides event store and transaction manager implementations plus ORM mappings and a migration. Includes a DBAL type override to persist microsecond-precision event timestamps (MySQL/Oracle).

View on GitHub
Deep Wiki
Context7

Doctrine implementation of event store and transaction manager for use with becklyn/ddd-core

Frequently asked questions about Ddd Doctrine Bridge
Can I use this package with Laravel’s Eloquent ORM, or is Doctrine required?
This package requires Doctrine ORM as it implements the event store and transaction manager for becklyn/ddd-core. Laravel’s Eloquent won’t work directly, so you’ll need to bind Doctrine’s EntityManager to Laravel’s service container and handle potential conflicts between Eloquent and Doctrine’s query builders or model hydration.
How do I set up the event store in Laravel without Symfony’s bridge?
Follow the package’s Doctrine ORM mappings (XML/annotation) and run the included Doctrine Migrations 3 migration to create the event store tables. You’ll need to manually integrate the event store into Laravel’s service container, likely via a custom service provider, and configure it to work with becklyn/ddd-core’s interfaces.
Does this package support Laravel’s async queues (e.g., jobs, tasks) alongside Doctrine transactions?
No, the package doesn’t natively integrate with Laravel’s queues. You’ll need to manually coordinate between synchronous Doctrine transactions and asynchronous Laravel jobs, possibly using sagas or compensating transactions to maintain consistency. Avoid mixing them in the same transaction scope.
What Laravel versions and PHP versions are officially supported?
The package doesn’t explicitly list Laravel versions, but it depends on Doctrine ORM and becklyn/ddd-core. Check the package’s dependencies for PHP version support (likely PHP 8.1+). For Laravel compatibility, ensure your version aligns with Doctrine’s requirements, as Laravel’s Eloquent isn’t directly supported.
How do I enable microsecond-precision timestamps for event sourcing in MySQL?
For MySQL, override the `datetime_immutable` DBAL type with `DateTimeImmutableMicrosecondsType` during bootstrapping. In Doctrine ORM 3+, this may be handled natively, so test your setup. For Oracle, also activate the `MicrosecondsOracleSessionInit` listener to ensure microsecond precision.
Will this package work with PostgreSQL or SQLite for event timestamps?
No, the microsecond-precision feature is currently limited to MySQL and Oracle. PostgreSQL and SQLite users will need to use standard timestamps, which lose microsecond granularity. Consider alternatives like custom serialization or application-layer timestamp handling if precision is critical.
How do I test event sourcing and transaction rollbacks in Laravel’s testing tools?
Testing event sourcing requires mocking the event store and transaction manager. Use Laravel’s testing tools (e.g., `Mockery` or `PHPUnit`) to create test doubles for the event store and verify aggregate consistency after replaying events. Rollbacks may need custom assertions to check transaction boundaries.
Are there alternatives to this package for event sourcing in Laravel?
Yes, consider Laravel-specific packages like `spatie/laravel-event-sourcing` or `prooph/event-store`. These integrate natively with Eloquent and Laravel’s ecosystem, avoiding Doctrine’s complexity. However, they may lack DDD-specific features like aggregate snapshotting or microsecond timestamps.
How do I handle schema conflicts between Laravel migrations and Doctrine migrations?
Run Doctrine migrations *after* Laravel’s schema updates to avoid conflicts. Use unique table prefixes (e.g., `ddd_`) for Doctrine tables to prevent naming collisions. If using Laravel’s migration system, ensure Doctrine’s migrations are triggered in the correct order, possibly via a custom artisan command.
Is this package actively maintained, and what’s the risk of using it in production?
The package has low community adoption (0 stars) and limited contributors, raising long-term viability concerns. Monitor dependency updates (e.g., Doctrine, PHP) for breaking changes. For production, consider forking the package to address Laravel-specific gaps or contributing fixes to the upstream project.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity