efureev/laravel-trees is a Laravel package for multi-tree structures for laravel.
It currently has 142 GitHub stars and 55.314 downloads on Packagist (latest version v5.6.0).
Install it with composer require efureev/laravel-trees.
Discover more Laravel packages by efureev
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package for implementing multi-tree hierarchical structures using the Nested Set Model.
This package supports Multi-Tree structures (multiple root nodes) and allows movement of nodes between trees.
It works with various model primary key types: int, uuid, and ulid.
int, uuid, and ulidNested Set Model is an efficient way to store hierarchical data in relational databases:
The nested set model numbers nodes according to a tree traversal, which visits each node twice, assigning numbers in the order of visiting, and at both visits. This leaves two numbers for each node, which are stored as attributes. Querying becomes inexpensive: hierarchy membership can be tested by comparing these numbers. Updating requires renumbering and is therefore expensive.
NSM shows good performance when:
It is highly recommended to use a database that supports transactions (like PostgreSQL) to protect tree structures from corruption.
composer require efureev/laravel-trees
./vendor/bin/phpunit --testdox
# or
composer test