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

Nestedset Laravel Package

kalnoy/nestedset

Laravel Eloquent implementation of the Nested Set model for storing hierarchical data. Manage trees with fast reads: add, move, delete nodes, retrieve ancestors/descendants, build menus, and handle multiple roots with scoped trees, all via familiar model methods.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: Trait-based implementation aligns perfectly with Laravel's Eloquent architecture. Optimized for read-heavy hierarchical data (e.g., menus, categories) with O(1) subtree queries but O(n) write complexity for tree modifications. Supports Laravel 7-12 with PHP 8.0+ requirements.
Integration feasibility: High for modern Laravel projects. Composer dependencies explicitly cover Laravel 7-12 and PHP 8.0+. Migration helper (Schema::nestedSet()) simplifies schema setup.
Technical risk: O(n) write operations could bottleneck large trees (>10k nodes). Manual lft/rgt manipulation risks tree corruption. Dependents count of 0 despite 3.7k stars suggests limited enterprise adoption. PHP 8.4 compatibility fixed in v6.0.6 but requires strict version adherence.
Key questions: How does the package handle concurrent tree modifications? What's the performance profile of rebuildFromTree() for 50k+ node datasets? Are there known issues with soft-delete + scoping interactions? Does it support sharding for extremely large trees?

Integration Approach

Stack fit: Native Eloquent integration via HasNestedSet trait. Works with existing Laravel models without major refactoring. Fully compatible with Laravel's query builder, scopes, and relationships.
Migration path: For new projects: install package → add trait → generate migration → seed data. For existing adjacency-list trees: write custom migration script to convert data using rebuildFromTree(). Prioritize testing with small datasets before full rollout.
Compatibility: Requires Laravel 7-12 and PHP 8.0+. Deprecated methods (e.g., appendTo) are replaced with appendToNode in v4.1+. Ensure legacy code updates during migration.
Sequencing: 1) Add package via Composer 2) Apply trait to target models 3) Run nestedSet migration 4) Implement scoping early if multi-tree support needed 5) Test critical operations (rebuild, move nodes) in isolation before production.

Operational Impact

Maintenance: Actively maintained with recent PHP 8.4/Laravel 12 fixes. MIT license simplifies

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.
marcelgwerder/laravel-api-handler
firebrikdotcom/conveyor-laravel-broadcaster
kanata-php/conveyor-laravel-broadcaster
alish/short-message
sonrac/lumen-league-oauth2
pushery/sanctum-hardening-for-laravel
evanschleret/laravel-uuidable
yigit-serin/laravel-openvidu
adachsoft/command-executor-lib
tagixo/document-builder
tagixo/page-builder
tagixo/mail-builder
tagixo/form-builder
primix/primix
tagixo/core
alesima/laravel-azure-service-bus
tomshaw/shopcart
likyly/laravel
darthsoup/shoppingcart
tdt/core