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

Reconstitutor Laravel Package

rekalogika/reconstitutor

Rekalogika Reconstitutor is a PHP library for rebuilding objects from persisted data. It maps database rows or arrays to typed objects through a simple reconstitution API, helping keep persistence logic separate from domain models.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. rekalogika/reconstitutor is a Symfony bundle that hooks Doctrine's UnitOfWork/transaction lifecycle to reconstitute (reset/refresh) managed entities after commit or rollback, so that long-lived in-memory object graphs don't silently drift from the database. It is a Doctrine ORM/ODM-ecosystem tool, not a Laravel one. On a stock Laravel stack (Eloquent, no Doctrine), there is no integration surface and the package delivers no value. Fit is only plausible where the application is Laravel plus Doctrine ORM via laravel-doctrine/orm (or a Symfony service in a mixed estate).

Where the value actually is. The package only matters when entity state survives across transactions in the same process: Octane/Swoole/RoadRunner workers, queue workers, Messenger consumers, or long-running console commands. In a classic per-request FPM model the entity manager is torn down each request and the package is dead weight.

What 2.5.0 changes. No breaking changes and no new public API. Two behavioral fixes land in exactly the highest-risk area:

  • handle begin-flush-clear-commit — an unusual but legal sequence (explicit begin, flush, clear, commit) that previously would have left tracked state inconsistent.
  • handle detach during transaction — entities detached mid-transaction were evidently mishandled.
  • Dependency widening to allow Symfony 8 (forward compatibility, low risk).
  • Test/cleanup work, including a negative test.

The meta-signal matters more than any individual line: two silent correctness bugs in transaction-lifecycle handling were fixed in a patch release. That is the class of defect this package exists to prevent, so it is also the class of defect it can introduce.

Technical risk: medium. The package operates on Doctrine internals; correctness is only as good as its coverage of transaction orderings. Failure is silent — a stale entity written back to the DB, or an entity left detached where code assumes managed — which surfaces as data corruption rather than an exception. Symfony 8 support is advertised but is a constraint widening, not evidence of production validation on 8.

Key questions.

  1. Do we actually run Doctrine ORM/ODM in any Laravel service, or is this assessment hypothetical?
  2. Which processes keep an EntityManager alive across transactions (Octane? queue workers?) and what is their recycle policy?
  3. Do we have any code path resembling begin → flush → clear → commit, or mid-transaction detach()? 2.4.0 was unsafe there.
  4. Doctrine ORM 2.x vs 3.x, and ODM vs ORM — is our version in the supported matrix?
  5. What is our soak-test story for worker processes? Unit tests will not catch this failure mode.

Integration Approach

Stack fit. Gate the decision on one fact: presence of Doctrine. If the answer is Eloquent-only, stop here — adopt nothing, and treat any request to add this as a signal that someone is porting a Symfony design into a Laravel codebase without a Doctrine foundation.

Migration path. Where Doctrine is present: composer require rekalogika/reconstitutor:^2.5, then register the bundle. In Symfony this is a one-line bundles.php entry. In Laravel it is not native — you would wire the bundle's services through a manual service provider or through the service container exposed by laravel-doctrine/orm, and confirm the package's Doctrine event-subscriber registrations bind to the same EntityManager instances the application uses (including any secondary/read connections). Budget real effort here; this is the step most likely to be underestimated.

Compatibility. Verify three axes before committing: PHP version against the package constraint, Doctrine ORM/ODM major version, and Symfony component versions (2.5.0 opens 8.x, but confirm 6.4/7.x LTS are still in range and that our pinned Symfony components don't conflict). Run composer why-not rather than trusting the release note.

Sequencing.

  1. Pin 2.5.0, not 2.4.0 — the two lifecycle fixes are the reason to move at all; landing on the prior minor would import known-unsafe behavior.
  2. Prototype against the single highest-risk consumer first: the long-running worker with the largest entity graph, not a web request path.
  3. Add a targeted regression test reproducing detach-during-transaction and the flush/clear/commit ordering before enabling globally.
  4. Soak in staging under worker-recycle conditions; compare persisted row state against expected after forced rollbacks.
  5. Roll out per-EntityManager, not fleet-wide, so blast radius is bounded.

Operational Impact

Maintenance. Single-maintainer project (priyadi) with a steady, small, high-quality commit cadence. Effective bus factor of one. Acceptable as a narrow internal utility; uncomfortable as a load-bearing dependency in a payments or ledger path without a fork-and-own contingency.

Support. Community OSS, no SLA, no vendor. Issue triage is best-effort. We own all diagnosis of production behavior.

Scaling. Cost is per-transaction overhead (reconstitution implies re-reading state); measure on the hottest transactional path before fleet rollout. The upside is architectural: it makes long-lived workers safe with shared entity managers, which is precisely what lets you avoid per-job process recycling — the trade is CPU for process churn.

Failure modes. Ranked by severity:

  • Silent stale writes — a detached or non-reconstituted entity flushed with outdated field values. Highest severity, lowest observability. Requires DB-level assertions (updated_at/version columns) to detect, not application logs.
  • Detach/identity-map inconsistency — code holding a reference to an object the package has since reconstituted; classic split-brain within one process.
  • Double-refresh cost on large graphs, presenting as latency regression under load, not as an error.
  • Version-matrix breakage on the next Doctrine major — this package lives on internals and will be an early casualty.

Ramp-up. Steep for a Laravel-native team. Reconstitutor only makes sense if engineers already reason fluently about Doctrine's identity map, UnitOfWork, clear(), detach(), and flush ordering. That conceptual gap — not the composer install — is the real adoption cost, and it is a hiring/training consideration as much as a technical one. Recommend one engineer owns the Doctrine lifecycle domain before this reaches production.

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.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core