Weave 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

Doctrine Behaviors Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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:

  • Are we actually running Doctrine in this Laravel app, or is that a hypothetical?
  • Which specific behaviors do we need, and why do the Eloquent equivalents not suffice?
  • Is the upstream KnpLabs package still maintained, and what is this fork's divergence delta?
  • Do the traits function without the Symfony bundle, or is DI wiring mandatory?
  • Who owns patching this if it breaks — we would be the only dependent.
  • What is the test coverage, and is there a security disclosure path?

Integration Approach

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):

  1. Spike, 1–2 days: install in a throwaway Laravel 11 + laravel-doctrine/orm branch, register two subscribers (Timestampable, SoftDeletable) manually in a service provider, prove a flush produces the expected column writes.
  2. Vendor or fork: pin to a commit SHA, mirror into an internal repository, add CI and a contract test suite. Do not depend on Packagist availability for a package with one release.
  3. Behavior-by-behavior rollout: enable one trait at a time with schema migrations gated behind review; Blameable and Translatable last, as both require application-level wiring (user resolver, locale resolver) and carry the highest blast radius.
  4. Keep namespaces upstream-compatible so a future swap back to KnpLabs or a community successor is a composer constraint change, not a refactor.

Operational Impact

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:

  • Silent no-op: subscriber not registered in the Doctrine event manager → columns silently stay NULL, no error. Add a schema/behavior smoke test in CI.
  • Bootstrap break: Symfony bundle DI extension invoked from a Laravel container → hard failure at boot, not at query time.
  • Soft-delete leakage: raw queries, report builders, or queue jobs that skip the filter return deleted rows.
  • Blameable misattribution: resolver bound to Auth::user() inside queued/console contexts writes NULL or the wrong principal.
  • Fork divergence: upstream bug fixes never arrive; we discover them via production incidents.
  • Mapping conflict: attribute metadata colliding with existing Doctrine mappings after an ORM major upgrade.

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.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource