Weave Code
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.
redaxo/debug
redaxo/test
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder