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

vasyaxy/doctrine-behaviors

vasyaxy/doctrine-behaviors provides reusable Doctrine behavior support for Laravel and PHP applications, making it easier to add common model behaviors and configuration without repetitive boilerplate. A lightweight option for projects already using Doctrine ORM.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • Despite the brief labeling it a "Laravel/PHP package," this is a Doctrine ORM entity-behavior library (traits + event subscribers/listeners + SQL filters) covering Blameable, Loggable, Sluggable, SoftDeletable, Uuidable, Timestampable, Translatable, and Tree. It is ORM-agnostic of Laravel and has no idiomatic Laravel surface (no service provider, no publishable config, no facade, no Eloquent hooks assumed).
  • Laravel's native ORM is Eloquent. Adopting this package is therefore not a package decision but a persistence-architecture decision: it presupposes a Doctrine-bridged Laravel app (or a Symfony service whose team is mislabeled). Fit is high only where Doctrine is already standardized; near-zero for a conventional Eloquent codebase.
  • Behaviors are cross-cutting persistence concerns. They belong in the data layer, so placement is architecturally clean — but they also mean the package sits on the write path for every affected entity, which raises the blast radius of any defect.

Integration feasibility

  • Technically feasible: traits are drop-in on entities, and listeners/filters are wired through Doctrine configuration. But all wiring, config, and migration ownership lands on us.
  • Schema consequences propagate: Translatable implies a companion translation table and changed fetch semantics; Tree implies parent/path columns and locking strategy; SoftDeletable implies filters that must be consistently applied across DQL, raw SQL, and reporting. In Laravel this collides with the Laravel-migrations-vs-Doctrine-migrations split.
  • Symfony coupling is likely (security token storage for Blameable, uid components for Uuidable), adding dependency surface to a Laravel app that does not otherwise need it.

Technical risk — High

  • Adoption signals are effectively absent: 1 star, 0 dependents, composite score 0.035. This reads as a personal fork of the well-known knplabs/doctrine-behaviors rather than an independently validated library.
  • Last release December 2023 means unverified compatibility with Doctrine ORM 3.x, DBAL 4, and PHP 8.3/8.4 — precisely the upgrade window most teams are entering now.
  • No evidence of CI, test coverage, semantic-versioning discipline, or a security-response process. MIT licensing means we can fork, but that converts a dependency into an owned asset.
  • Failure here is data failure, not rendering failure: leaked soft-deleted rows, mis-attributed blame, corrupted tree paths, or wrong-locale reads.

Key questions

  1. Why this fork rather than knplabs/doctrine-behaviors — does it fix a specific, documented defect?
  2. Do we already run Doctrine in Laravel, or would this introduce it?
  3. Which behaviors are actually required, and can any be satisfied by Eloquent-native equivalents?
  4. Who owns listener/filter wiring, migrations, and Doctrine upgrades?
  5. What is the exit plan if the upstream goes quiet (it already has)?
  6. Is Translatable genuinely needed — it is the highest-complexity, highest-regression behavior in the set?

Verdict: Do not adopt as a primary dependency without a timeboxed spike and a fork-and-own commitment. Preferred path: Eloquent-native equivalents, or knplabs/doctrine-behaviors if Doctrine is mandated.

Integration Approach

Stack fit

  • Eloquent-first Laravel app (most likely): poor fit. Map requirements to first-party/native equivalents — SoftDeletes, timestamps, HasUuids, spatie/laravel-sluggable, spatie/laravel-translatable, kalnoy/nestedset, spatie/laravel-activitylog. Lower risk, zero new persistence paradigm.
  • Doctrine-already-in-Laravel: moderate fit via a Doctrine bridge, but treat this package as a candidate among several, not the default.
  • Symfony/Doctrine shop: the package is on-home-turf, yet still outranked by the established upstream on maintenance signal.

Migration path

  • Run a one-to-two day spike in a throwaway branch: Doctrine bridge + three entities exercising Timestampable, SoftDeletable, Sluggable only. Verify filter behavior on DQL and raw SQL, confirm migration generation, record the actual installed versions.
  • Gate the decision on that spike plus a dependency audit (transitive Symfony/uid packages, constraint ranges, abandoned packages).

Compatibility

  • Pin PHP, doctrine/orm, and doctrine/dbal explicitly; confirm attribute-based mapping (not annotations) and ORM 3 compatibility before committing.
  • Verify Uuidable's generator source and Blameable's user-resolution mechanism; both commonly assume Symfony services that Laravel must substitute.

Sequencing

  1. Decide the ORM strategy first — everything downstream depends on it.
  2. Spike + compatibility matrix + dependency audit.
  3. If proceeding: vendor/fork into an internal namespace, add CI and a regression test suite for each behavior used.
  4. Pilot one bounded domain with low-risk behaviors (timestamps, slugs).
  5. Add SoftDeletable/Blameable only after filter and context-handling tests exist.
  6. Defer Translatable and Tree until last; they carry the highest schema and query-semantics cost.
  7. Document an exit path (replacement traits or upstream migration) at adoption time, not later.

Operational Impact

Maintenance

  • Realistically, we become the maintainer. Budget ongoing effort for dependency bumps, Doctrine major-version churn, and building the test suite the project appears to lack. A stale-since-2023 dependency in the persistence layer is a recurring tax, not a one-time install.

Support

  • No vendor, no SLA, no release cadence, and a community too small to answer questions. Support tier is "whoever on our team knows Doctrine," which must be a named individual, not an assumption.

Scaling

  • Runtime cost of listeners/subscribers and SQL filters is typically negligible next to query cost. The real scaling concerns are: Translatable join growth and N+1 risk, tree writes requiring locking under concurrency, translation-table row growth, and soft-delete filters silently excluding rows from analytics and counts.

Failure modes

  • Soft-deleted records resurfacing through raw SQL or filter-less DQL; silently wrong aggregate counts in reporting.
  • Blameable nulls or wrong attribution in queue workers, console commands, and unauthenticated contexts.
  • Slug uniqueness races under concurrent writes; tree corruption on concurrent moves; wrong-locale fallback in Translatable.
  • Breakage at Doctrine/PHP upgrades, discovered late because no tests pin behavior.

Ramp-up

  • Doctrine-fluent engineer: roughly 1–2 days to be productive, plus spike time.
  • Eloquent-only team: 1–2 weeks to absorb Doctrine mappings, listeners, filters, repositories, and migration tooling — a cost that must be charged against this package's business case, and one that usually loses to Eloquent-native alternatives.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
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