Download the PHP package vusys/laravel-nestedset without Composer
On this page you can find all versions of the php package vusys/laravel-nestedset. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vusys/laravel-nestedset
More information about vusys/laravel-nestedset
Files in vusys/laravel-nestedset
Package laravel-nestedset
Short Description Nested set model implementation for Laravel 11+.
License MIT
Informations about the package laravel-nestedset
vusys/laravel-nestedset
A modern Laravel implementation of the nested-set model for hierarchical data — strict types throughout, PHPStan level 9, atomic CASE-WHEN mutations, multi-tree scoping, soft-delete cascade, live aggregate roll-ups (eager or lazy with TTL), subtree cloning, JSON tree import/export, materialised-path columns, and an opinionated repair toolkit.
Declare aggregates on the model and the SUM / COUNT / AVG / MIN / MAX roll-ups are maintained automatically as the tree changes:
Why nested set?
The nested-set encoding stores lft and rgt integers on every node so any subtree, ancestor chain, or descendant set is a single BETWEEN query — no recursive CTEs, no N+1 loops. The price is that mutations (insert / move / delete) have to shift many rows to keep the lft/rgt sequence dense, so it's best suited to read-heavy hierarchies: category trees, menu structures, org charts, comment threads.
This package executes every shift as a single CASE WHEN UPDATE, so even a subtree move that touches thousands of rows is one round trip.
Installation
The service provider auto-registers Blueprint macros and registers a publishable config file:
See the Installation guide for the rest of the setup (migration macros, model trait, scoped trees).
Documentation
Full documentation lives at https://vusys.github.io/laravel-nestedset/.
- Getting Started — Introduction · Installation · Migration · Primary Keys · Model Setup
- Tree Operations — Inserting & Moving · Reordering Siblings · Soft Deletes · Bulk Insertion · Cloning Subtrees · Materialised Paths
- Querying — Tree Queries · Eloquent Relations · In-memory Tree Shaping · Walking Subtrees · Tree Exporters & JSON Import · Tree Diff · Inspection · Scoped Trees
- Aggregates — Overview · Setup · Reading · Declaring · Filtered · Collection · Listeners · Variance & Stddev · Weighted Avg & Booleans · Means · Quantiles · Top-K · Bitwise · Lazy · Recipes · Maintenance · Drift & Limitations
- Maintenance — Tree Repair · Repairing Aggregates · Corruption Reference
- Reference — Configuration · Testing Helpers · Factory Tree Builder · Transactions · Events · Production Notes · Glossary
- Internals — Architecture Overview
The site is built from the markdown in docs/ — if you spot an error, edit the source and open a PR.
Contributing
Run the full check suite before opening a PR:
All four must pass on CI before merge.
Changelog
See CHANGELOG.md for the release history and the pre-1.0 backwards-compatibility breaks called out per version.
License
MIT. See LICENSE.
All versions of laravel-nestedset with dependencies
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/events Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0