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

Baum Laravel Package

yajra/baum

yajra/baum adds nested set trees to Laravel Eloquent, so you can store and query hierarchical data like categories and menus. Create, move, and reorder nodes and fetch ancestors, descendants, and siblings efficiently through an intuitive ActiveRecord-style API.

View on GitHub
Deep Wiki
Context7

Baum is an implementation of the Nested Set pattern for Eloquent models.

Frequently asked questions about Baum
What is yajra/baum and what does it do?
yajra/baum is an implementation of the Nested Set pattern for Laravel Eloquent models. It stores lft, rgt, depth, and parent_id columns so you can save hierarchical data such as categories, navigation menus, taxonomies, and threaded comments. It provides an ActiveRecord-style API for creating, moving, and reordering nodes and for fetching ancestors, descendants, and siblings. Reads of subtrees and ancestors are very cheap, while inserts and moves require updating ranges of rows.
How do I install yajra/baum with Composer?
The normal approach is to run composer require yajra/baum and then add the required lft, rgt, depth, and parent_id columns to your table through a migration. In practice you should expect the Composer constraint resolution to fail against modern Laravel versions, because the package traces back to the Laravel 4 and 5 era. If it does install, plan a spike to confirm the model events, mass assignment, and query builder paths still behave correctly on your framework version before relying on it.
Does yajra/baum support Laravel 10, Laravel 11, or PHP 8.2?
There is no guarantee of support for Laravel 10, Laravel 11, or PHP 8.2 and above. The package originates from the Laravel 4 and 5 era and depends on Eloquent internals that have changed significantly across Laravel 6 through 11. With no maintainer signal and no active user base, no one is keeping it current against newer framework or PHP releases. Treat any successful install on a modern stack as unverified until your own test suite proves otherwise.
Is yajra/baum still maintained and safe to use in production?
The technical assessment rates this package as high risk and effectively abandoned, with minimal stars, no dependents, and no security patch path. There is no evidence of production use and no community pressure keeping it compatible with modern Laravel. For new product work the recommendation is to deprioritize it. If you need it to unblock a legacy system, plan to fork and own the code rather than treat it as a normal dependency.
What are the best alternatives to yajra/baum for nested sets in Laravel?
kalnoy/nestedset is the de facto maintained nested set implementation for Eloquent and covers the same use case with comparable semantics. If you prefer recursive queries over stored ranges, staudenmeir/laravel-adjacency-list provides recursive CTE based tree handling. For new work, evaluating these maintained options is almost always cheaper than adopting or forking yajra/baum. Compare their API semantics against your existing code before migrating.
How do I get ancestors, descendants, and siblings of a node with yajra/baum?
Baum exposes ActiveRecord-style methods on your model for ancestors, descendants, and siblings, which resolve using the lft and rgt boundaries rather than recursive queries. Because the tree structure is encoded in those columns, subtree and ancestor lookups are effectively constant time for the subtree scope. You should verify these query paths against your own data set during a spike, since the implementation predates several Eloquent query builder changes.
How does yajra/baum handle moving nodes and reordering the tree?
Moving a node rewrites the lft and rgt values of the affected contiguous row ranges, which is the standard O(n) write amplification of the nested set pattern. These operations must be wrapped in a database transaction, and ideally serialized per tree, or a partially applied move leaves the tree inconsistent. Older implementations are weakest exactly here, so confirm that move and reorder paths are actually tested, not just documented. Silent corruption from a failed move surfaces as wrong data on a category page rather than as an alert.
Does yajra/baum support multi-tree scoping and soft deletes?
Multi-tree scoping and soft delete behavior are the two paths most likely to be under-tested in a package of this vintage. Baum predates many of the soft delete and global scope conventions that modern Laravel packages rely on, so behavior on deleted or scoped nodes is not guaranteed. Verify these paths with your own tests rather than trusting the documentation. If your hierarchy requires per-tree isolation, confirm how the scope column interacts with every move and delete operation.
What are the concurrency risks of using yajra/baum with nested sets?
Nested set writes touch contiguous ranges of rows, so concurrent inserts and moves can interleave and produce inconsistent lft and rgt values. Older implementations rarely provide row locking or application-level serialization per tree, which is where corruption enters. The failure mode is silent: the tree degrades quietly instead of throwing an error, and the damage shows up later as bad hierarchy in your UI. Budget for explicit transactions, locking, and integrity checks in your own code.
Should I fork yajra/baum or migrate to kalnoy/nestedset?
Forking is tractable because the code surface is small and auditable, but it reframes the decision from adopting a dependency to owning a few hundred lines of tree logic, complete with a named maintainer and a test suite. Migrating to kalnoy/nestedset gives you active maintenance and a security patch path at the cost of adapting your API usage. For new product work, deprioritize yajra/baum entirely. For legacy unblocking, decide explicitly between containing it with a fork or replacing it, and record who owns that decision.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections