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 Relations Laravel Package

midnightluke/doctrine-relations

Adds Laravel-style relationships to Doctrine entities, letting you define hasOne, hasMany, belongsTo, and belongsToMany associations with simple attributes and query them through an intuitive, Eloquent-like API.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Stack decision: Doctrine vs. Eloquent in a Laravel app. This package only has a reason to exist if the product has already committed to Doctrine ORM inside Laravel (typically for DDD-style aggregates, explicit mapping, or a codebase ported from Symfony). Treat it as a signal in that larger architecture choice, not as a standalone dependency decision.
  • Build vs. buy for the "relation ergonomics" layer. If the team wants Eloquent-style relation access ($order->lines, lazy vs. eager loading, cascade behavior) on top of Doctrine entities, the options are: write ~50–200 lines of internal traits/annotations, adopt this package, or refactor the domain layer to Eloquent. This package is the cheapest starting point for option two, and a useful reference implementation even if the decision is "build."
  • Feature scoping for relation-heavy surfaces. Whether to invest in a richer relational model (nested resources, aggregate boundaries, graph serialization) depends on how painful relation loading is today. This package is a probe: if a one-day spike removes real friction, the feature is worth scoping; if it doesn't, the friction is architectural, not library-shaped.
  • Roadmap sequencing for a Laravel↔Doctrine migration. For teams mid-migration from Eloquent to Doctrine (or running hybrid), a thin compatibility layer reduces the blast radius of moving one aggregate at a time, letting the migration ship incrementally instead of as a big-bang rewrite.
  • Serialization / API contract decisions. Relation traversal helpers directly affect how nested resources are shaped in API responses and how many queries a list endpoint issues. Any adoption should be tied to a measurable N+1 improvement in a real endpoint, not adopted speculatively.

When to Consider This Package

Consider it only when all of the following hold:

  • The application is already on Doctrine ORM within Laravel and will stay there for the foreseeable roadmap.
  • The gap is narrow and well understood — relation access ergonomics, not persistence, migrations, or the ORM integration itself (that's a different layer, e.g. laravel-doctrine/orm).
  • The team can read and own the source. With 0 stars, 0 dependents, and no downstream users, this is effectively an unreviewed personal utility: assume bus factor of 1, no compatibility guarantees, no issue-triage SLA, and a real chance the repo goes dormant. Plan to vendor/fork it into the repo rather than depend on Packagist semver.
  • A time-boxed spike (≤1 day) confirms it works on your Laravel/PHP versions and Doctrine major version, and that its behavior matches your aggregate-mapping conventions.

Look elsewhere — or don't adopt — when:

  • The product is greenfield Laravel. Eloquent's relation API is the default, is maintained by the framework, and has vastly more community support. Choosing Doctrine here is a large, mostly irreversible bet that this package cannot justify on its own.
  • You need vendor support, security patching commitments, or a documented upgrade path. A 0-dependent package fails procurement on maintenance risk alone, regardless of code quality.
  • The perceived problem is actually N+1 queries or mapping complexity — those have first-party Doctrine answers (fetch joins, QueryBuilder, DQL tuning, attribute mapping) that don't require a dependency.
  • Your team has no Doctrine fluency. Doctrine's learning curve is the dominant cost; a helper library on top does not reduce it and may mask it.

Verdict: Not an adopt-by-default dependency. Legitimate as a read-and-fork reference for teams already committed to Doctrine-in-Laravel, and as a cheap spike to size a real pain point. Do not let it appear in a dependency manifest without a named internal owner.

How to Pitch It (Stakeholders)

To executives: This is a small, MIT-licensed helper that makes database relationships easier to work with in a specific, minority technical setup — a Laravel app that uses Doctrine instead of Laravel's default database layer. It is not a strategic dependency. It has zero external users and a single maintainer, so the recommendation is to treat it as a design reference and a one-day experiment, not a long-term vendor. Cost of trying is a day of engineering; cost of betting on it as infrastructure is a maintenance liability we'd own forever.

To engineering: If we've chosen Doctrine, this package targets a real ergonomics gap and is worth a short spike against our Laravel/PHP/Doctrine versions. Expect to vendor the code rather than depend on it — no downstream users means no compatibility signal. Success criteria for the spike: one existing endpoint with nested relations, measured query count before/after, and a decision record on build-vs-fork-vs-skip. If the spike doesn't produce a measurable N+1 or boilerplate reduction, the friction is architectural and we close it out.

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.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle