# staudenmeir/eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels

Repository: https://github.com/staudenmeir/eloquent-has-many-deep
Canonical: https://ross.abutalabs.com/products/eloquent-has-many-deep
Language: PHP
License: MIT
License Family: permissive
Last push: 2026-03-14T10:55:06+00:00

## Health v2 (maintenance only)
Score: 74/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 72, release rhythm 62, longevity 100
- inputs: {"age_days": 3000, "days_push": 172, "days_rel": 172, "gap_med": 40, "n_releases_24m": 12}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2870, forks 158 (observed 2026-08-28T04:07:27.100289+00:00)

## What it is
A Laravel Eloquent package extending HasManyThrough relationships to support unlimited levels of intermediate models. It supports many-to-many, polymorphic relationships, and their combinations, with compatibility across Laravel 5.5+.

## Use cases
- query relationships across unlimited intermediate tables in Laravel Eloquent
- define deep has-many-through relationships spanning multiple models
- combine many-to-many and polymorphic relationships in a single chain
- traverse nested relationships like country -> users -> posts -> comments
- get deep has-one relationships through multiple intermediate models
- apply constraints on intermediate and pivot tables in deep relationships

## When to choose
- you need Eloquent relationships deeper than the single intermediate model HasManyThrough allows
- you want to chain existing relationships or define multi-level relations manually with custom keys
- you need support for polymorphic and many-to-many combinations in deep relation chains

## When to avoid
- your relationships are only one level deep and native Laravel HasManyThrough suffices
- you are not using Laravel or Eloquent ORM
- you prefer writing raw SQL joins or query builder queries for complex multi-table joins

## Facets
- artifact type: library
- maturity: active
- function: orm, database
- domain: web-development, backend, databases
- platform: php
- tags: eloquent, laravel-package, has-many-through, relationships, composer-package, laravel

## Member repositories
- staudenmeir/eloquent-has-many-deep (main) score 74

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:27.100289+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:48:28.297664+00:00, confidence not recorded.
  - readme: https://github.com/staudenmeir/eloquent-has-many-deep (fetched 2026-08-28T04:07:27.100289+00:00, sha 39bb7fac4d48)
- Data as of 2026-08-30T08:39:29.467469+00:00.
