# staudenmeir/laravel-adjacency-list

Recursive Laravel Eloquent relationships with CTEs

Repository: https://github.com/staudenmeir/laravel-adjacency-list
Canonical: https://ross.abutalabs.com/products/laravel-adjacency-list
Language: PHP
License: MIT
License Family: permissive
Last push: 2026-04-13T19:39:53+00:00

## Health v2 (maintenance only)
Score: 82/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 77, release rhythm 79, longevity 100
- inputs: {"age_days": 2689, "days_push": 142, "days_rel": 142, "gap_med": 27, "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 1577, forks 113 (observed 2026-08-28T04:05:06.134302+00:00)

## What it is
A Laravel Eloquent extension that adds recursive relationships for traversing tree and graph data structures using common table expressions (CTEs). It supports one-to-many hierarchies like nested comments and many-to-many graphs, with features like depth, path, cycle detection, and nested results.

## Use cases
- query hierarchical categories with parent-child relationships in Laravel
- traverse nested comments or page hierarchies with Eloquent
- load entire ancestor or descendant trees of a node recursively
- model many-to-many graph relationships with multiple parents
- detect cycles in recursive data structures
- get node depth and path in a hierarchy via CTEs

## When to choose
- you use Laravel Eloquent and need recursive tree or graph queries
- your database supports CTEs (MySQL 8+, PostgreSQL, SQLite, SQL Server)
- you need hierarchical data features like depth, path, or cycle detection out of the box

## When to avoid
- you are not using Laravel or Eloquent ORM
- your database does not support recursive CTEs
- you only need simple one-level parent-child relations without recursion

## Facets
- artifact type: library
- maturity: stable
- function: orm, database, database-driver
- domain: databases, web-development, backend, developer-tools
- platform: php
- tags: eloquent, recursive-queries, cte, tree-structures, graph-traversal, hierarchical-data, laravel-package, laravel

## Member repositories
- staudenmeir/laravel-adjacency-list (main) score 82

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:06.134302+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-30T03:57:11.287195+00:00, confidence not recorded.
  - readme: https://github.com/staudenmeir/laravel-adjacency-list (fetched 2026-08-28T04:05:06.134302+00:00, sha cb2d545441c7)
- Data as of 2026-08-30T08:39:29.467469+00:00.
