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

fico7489/laravel-eloquent-join

Laravel Eloquent Join adds SQL JOIN support to Eloquent models and relationships, letting you sort, filter, and query joined tables directly while keeping familiar query builder syntax. It simplifies complex relationship queries and helps avoid extra queries.

Deep Wiki
Context7

Product Decisions This Supports

  • Feature scoping for list/search experiences: Enables "sort by customer name," "filter by team," and "search across related records" on paginated index pages without loading entire relation sets into PHP. This directly supports decisions about whether to build richer admin tables, dashboards, and API filters.
  • Build vs. buy for query infrastructure: Replaces hand-rolled JOIN clauses scattered across repositories with a relationship-aware API (joinRelationship), reducing custom query code and the maintenance burden that comes with it. For a 339-star, MIT-licensed package with a 2025 release, this is a low-cost dependency bet.
  • Roadmap sequencing for performance work: Gives the team a targeted lever for N+1 and over-fetching problems on read-heavy endpoints. PMs can prioritize "make the orders list sortable and fast" as a contained initiative rather than a broader query-layer rewrite.
  • Use cases to validate with users: Reporting and export screens, support/admin tooling with cross-entity filtering, marketplace or CRM-style lists where related-entity columns are first-class, and APIs where clients need server-side sorting on joined fields.
  • Trade-off visibility: Forces an explicit decision on where Eloquent ergonomics end and raw SQL/reporting infrastructure begins, which is useful when scoping analytics features that may outgrow the ORM.

When to Consider This Package

  • Adopt when multiple endpoints need to filter, sort, or paginate on columns from belongsTo/hasMany relations, and the current approach (eager loading plus in-memory sorting) is causing slow responses, high memory use, or incorrect pagination.
  • Adopt when the team already defines relationships consistently on models and wants joins to follow those definitions rather than duplicating foreign-key logic in query builders.
  • Adopt when you want to eliminate repetitive join code in repositories/services and reduce the bug surface of manually written join conditions.
  • Look elsewhere when the need is true analytical reporting—complex aggregations, window functions, or a separate warehouse—where raw SQL, a query builder, or a BI tool is more appropriate.
  • Look elsewhere when the app is small and N+1 issues are better solved with eager loading, withCount/withAggregate, whereHas subqueries, or caching.
  • Look elsewhere when relationships are heavily polymorphic or unconventional; relationship-driven joins may not cover those cases cleanly.
  • Look elsewhere when the team is uncomfortable with the select discipline joins require (ambiguous columns, duplicate hydration) or cannot invest in query-level tests.
  • Validate first: Laravel/PHP version compatibility, behavior with soft deletes and global scopes, and whether existing indexes support the join columns.

How to Pitch It (Stakeholders)

For executives: This is a small, MIT-licensed addition that lets us ship faster, more flexible list and reporting screens—sorting and filtering by related data—without loading unnecessary records. Expected outcomes are quicker page loads, lower database load, and less custom query code to maintain. Cost is low and the package is actively released; the main investment is engineering validation time.

For engineering: fico7489/laravel-eloquent-join adds relationship-aware joins to Eloquent, so we can move filtering, sorting, and pagination into SQL while keeping model-defined relationship semantics instead of hand-writing joins. It reduces N+1 and over-fetching on read-heavy endpoints and consolidates join logic in one place. Adoption requires care around column selection, ambiguous names, global scopes, and index coverage, plus tests for each joined query. Recommended first step: pilot on one high-traffic index endpoint, measure query count and response time, then standardize if results hold.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource