miets/doctrine-behaviors
Doctrine ORM behavior extensions: reusable traits, event listeners and mappings that add timestampable, sluggable, soft-deletable, blameable and tree behavior to entities. Cuts boilerplate, keeps models clean, and drops into existing Doctrine setups with simple config.
Architecture fit — poor for a Laravel codebase, plausible only in a Doctrine-on-Laravel outlier.
miets/doctrine-behaviors is a Doctrine ORM trait/event-subscriber library targeting Symfony 7+. Laravel's default persistence layer is Eloquent, which has no relationship to Doctrine's EventManager, UnitOfWork, or metadata drivers. The traits (Timestampable, Blameable, Sluggable, SoftDeletable, Translatable, Tree, Loggable, Uuidable) attach to Doctrine entities and are activated by subscribers registered against Doctrine's event system. In a standard Laravel app there is nothing for them to attach to. Fit becomes non-trivial only if the organization already runs laravel-doctrine/orm — a minority architecture — and even then the package's Symfony bundle/DI wiring is dead weight that must be replaced with a Laravel service provider.
Integration feasibility — low, and the effort buys duplicated functionality.
Every behavior this package offers has a first-class Eloquent equivalent: native timestamps, SoftDeletes, spatie/laravel-sluggable, astrotomic/laravel-translatable, spatie/laravel-activitylog for blame/audit, and kalnoy/nestedset for trees. Adopting this package therefore means introducing Doctrine and re-implementing behavior wiring, to reach parity with what Eloquent provides out of the box. Feasibility is further gated by unclear constraints: verify PHP version floor, Doctrine ORM 2.x vs 3.x support, and whether the traits are framework-agnostic or hard-depend on symfony/config / symfony/dependency-injection / symfony/http-kernel at runtime.
Technical risk — high, driven by ecosystem signals rather than code quality.
2 stars, 0 dependents, score 0.04, and a single release (2024-02-07) describe a personal fork, almost certainly of KnpLabs/DoctrineBehaviors, modernized for Symfony 7. That implies: bus factor of one, no downstream validation, no security review, no observable CI/coverage signal, and a real chance of divergence from upstream. Supply-chain exposure is modest (MIT, small surface), but maintenance and correctness risk are not. The opportunity score of 44.49 reflects a genuine gap (Symfony 7 support for a widely used behavior set) that this fork is attempting to fill with essentially no adoption.
Key questions for the team:
KnpLabs package still maintained, and what is this fork's divergence delta?Stack fit — recommend rejection for Eloquent-based Laravel; conditional pilot for Doctrine-based Laravel.
If the target application is Eloquent-first, the correct decision is to close the evaluation and select Spatie/Eloquent-native packages. If the organization has a Doctrine-on-Laravel service (via laravel-doctrine/orm), this fork is a candidate for a narrow, time-boxed spike rather than a platform commitment.
Migration path — asymmetric.
The real upgrade path this package serves is Symfony 5/6 + KnpLabs/DoctrineBehaviors → Symfony 7. For a Laravel team, there is no migration path because there is no Doctrine footprint to migrate. Do not let a Symfony-side upgrade need bleed into the Laravel roadmap; treat them as separate decisions with separate owners.
Compatibility — verify before committing.
Confirm the PHP floor (likely 8.2+ given Symfony 7), the supported Doctrine ORM major version, and whether laravel-doctrine/orm 2.x's event manager accepts the package's subscribers unchanged. Attribute-based mapping (#[Timestampable], #[Sluggable]) versus annotation-based mapping matters if any entities are legacy.
Sequencing (if pursued):
laravel-doctrine/orm branch, register two subscribers (Timestampable, SoftDeletable) manually in a service provider, prove a flush produces the expected column writes.Blameable and Translatable last, as both require application-level wiring (user resolver, locale resolver) and carry the highest blast radius.KnpLabs or a community successor is a composer constraint change, not a refactor.Maintenance — plan to own it. Single maintainer, sparse release cadence, no dependents means we will be the de facto QA function. Budget ongoing ownership: an internal fork, a named owner, and a quarterly review of upstream diff. This is the dominant cost, not the initial integration.
Support — thin.
No vendor, effectively no community corpus at 2 stars. Documentation will come from the upstream KnpLabs README, which may not match this fork's Symfony 7 changes. Expect internal knowledge to be the only reliable source; if the team does not already know Doctrine deeply, the support burden is effectively unbounded.
Scaling — acceptable compute, non-trivial query design.
Behavior subscribers fire per entity per flush; Timestampable/Blameable add negligible overhead, but Translatable introduces join-heavy loads and fallback logic, Tree adds recursive queries, and SoftDeletable requires every query path to respect the filter. At scale, the risk is not CPU — it is silent correctness drift in reporting and admin queries that bypass the soft-delete filter.
Failure modes to instrument:
NULL, no error. Add a schema/behavior smoke test in CI.Auth::user() inside queued/console contexts writes NULL or the wrong principal.Ramp-up — bimodal. For engineers fluent in Doctrine, roughly a day to be productive with the traits and subscribers. For an Eloquent-only team, this is a multi-week Doctrine onboarding (UnitOfWork semantics, proxy objects, metadata drivers, flush lifecycle) before the package itself is even the hard part — a cost that dwarfs the value of the behaviors it provides.
How can I help you explore Laravel packages today?