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

Laravel Eloquent Join Relation Laravel Package

atldays/laravel-eloquent-join-relation

Add SQL joins to Laravel Eloquent relationships without dropping to the query builder. atldays/laravel-eloquent-join-relation lets you join related tables through existing relationship definitions, filter and sort by joined columns, and keep clean, readable model code.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: This package is an adjunct to Eloquent for read-heavy query paths where joins are already used for filtering, sorting, or validation. It hydrates BelongsTo and HasOne relations from joined rows without follow-up queries, which fits Laravel API/resource patterns where relation objects must remain usable. The narrow scope is a positive for predictability, but it is not a general ORM replacement and does not address collection or polymorphic relations.

Integration feasibility: Feasible for targeted queries, not a broad drop-in change. Adoption requires explicit query design: selecting joined columns with expected aliases/keys, using related + join + hydrate, and enforcing ordered nested relation paths. Documentation with SQL examples and multi-join test coverage lowers initial risk, but v1.0.0 has no long-term production track record.

Technical risk: Primary risks are first-release maturity, hydration semantics around duplicate parent rows, null handling on left join, nested path ordering exceptions, and fallback lazy-loading protection behavior in production. Unsupported polymorphic and collection relations limit standardization. Join column collisions, soft deletes, global scopes, composite/ULID keys, and custom casts need validation against the package contract.

Key questions: What is the exact row-shape and alias contract for hydration? How are duplicate parent rows and relation cardinality resolved? How do soft deletes, global scopes, composite keys, and custom casts behave? What is the measured performance profile versus eager loading on large joined result sets? What is the maintainer support model and security posture? What is the roadmap for HasMany and polymorphic relations? How does fallback lazy-loading protection fail in production—exception, log, or silent fallback? What is the upgrade policy for Laravel 13?

Integration Approach

Stack fit: Best suited to Laravel 11-13 services on PHP 8.2+ that already use explicit joins for list, report, or detail endpoints returning BelongsTo/HasOne relations. Less suitable for domains dependent on polymorphic or collection relations. Teams need comfort with SQL join semantics and Eloquent internals.

Migration path: Do not rewrite all queries. Select a pilot set of read endpoints with stable joins and simple relation paths, ideally where N+1 or eager-load cost is measurable. Introduce the package behind existing repository/query objects and add regression tests comparing hydrated relations to current eager-loaded output. Expand only after output parity and performance are proven.

Compatibility: Confirm runtime PHP 8.2+, Laravel 11-13, database driver, and CI matrix. Validate against the production database engine, especially if using PostgreSQL or MySQL-specific SQL. Check Composer constraints and pin the package version. For Laravel 13, verify the production application version and surrounding package compatibility before adoption.

Sequencing: 1) Run a proof-of-concept on one endpoint. 2) Define join/alias conventions and nested-path ordering rules. 3) Add contract tests for left-join nulls, duplicate rows, nested paths, and unsupported relations. 4) Benchmark query count and latency versus eager loading. 5) Document supported query patterns internally. 6) Pilot in a non-critical path. 7) Roll out by query family. 8) Defer collection and polymorphic use cases until explicitly supported.

Operational Impact

Maintenance: Low-to-moderate. The package adds a narrow abstraction over joins; ongoing burden is mainly query conventions, alias discipline, and regression tests. As a v1.0.0 release, expect API stabilization and possible breaking changes before a later major version. Pin versions and monitor release notes.

Support: Requires Laravel/Eloquent and SQL competency. Documentation and contributor guidelines help, but first-release community support may be limited. Assign an internal owner for query patterns, upgrade validation, and incident triage.

Scaling: Intended to reduce follow-up queries and N+1 overhead on read paths. Large multi-joins can increase row duplication, memory use, and result-set size, so benchmark and cap result sets. Hydration is per query and is not a caching layer; scaling risk rises with nested paths and wide joins.

Failure modes: Incorrect aliases or missing columns can cause hydration failures. Unordered nested paths raise explicit exceptions. left join may correctly return null relations for missing records. Duplicate parent rows can create ambiguous relation state. Unsupported polymorphic or collection relations will fail or require fallback. Fallback lazy-loading protection may throw in production if query shape is wrong. Mitigate with contract tests, feature flags, monitoring, and rollback to eager loading.

Ramp-up: Moderate. Developers must understand join shape, relation keys, nested-path ordering, and the manual hydration API. Provide internal examples, a short enablement session, and a pilot retrospective before broader adoption.

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.
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log