efureev / laravel-trees
Multi-Tree structures for Laravel
Installs: 38 682
Dependents: 3
Suggesters: 0
Security: 0
Stars: 126
Watchers: 3
Forks: 16
Open Issues: 2
Requires
- php: ^8.4
- efureev/support: ^5.0
- illuminate/database: ^11.36
- illuminate/events: ^11.36
Requires (Dev)
- fakerphp/faker: ^1.24
- orchestra/testbench: ^9.8.0
- phpunit/phpunit: ^11.5
- squizlabs/php_codesniffer: ^3.11
- symfony/var-dumper: ^7.2
- dev-master
- v6.x-dev
- v6.0.0
- v5.x-dev
- v5.2.1
- v5.2.0
- v5.1.1
- v5.1.0
- v5.0.0
- v5.0.0-rc2
- v5.0.0-rc1
- v4.0.0
- v3.8.4
- v3.8.3
- v3.8.2
- v3.8.1
- v3.8.0
- v3.7.2
- v3.7.1
- v3.7.0
- v3.6.2
- v3.6.1
- v3.6.0
- v3.5.3
- v3.5.2
- v3.5.1
- v3.5.0
- v3.4.1
- v3.4.0
- v3.3.3
- v3.3.2
- v3.3.1
- v3.3.0
- v3.2.0
- v3.1.2
- v3.1.1
- v3.1.0
- v3.0.1
- v3.0.0
- v2.5.0
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- 1.6.0
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.0
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.0
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- 1.0.0
- dev-lara11
- dev-next
- dev-php7
This package is auto-updated.
Last update: 2025-02-25 18:13:59 UTC
README
Laravel Tree Structure
Contents:
Information
This package is Multi-Tree structures (a lot of root-nodes).
Screenshots


What are nested sets?
Nested sets or Nested Set Model is a way to effectively store hierarchical data in a relational table. From wikipedia:
The nested set model is to number the 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 two attributes. Querying becomes inexpensive: hierarchy membership can be tested by comparing these numbers. Updating requires renumbering and is therefore expensive.
Applications
NSM shows good performance when tree is updated rarely. It is tuned to be fast for getting related nodes. It is ideally suited for building multi-depth menu or categories for shop.
Requirements
- PHP: 8.2|8.3
- Laravel: ^11.*
It is highly suggested to use database that supports transactions (like Postgres) to secure a tree from possible corruption.
Installation
composer require efureev/laravel-trees
Testing
./vendor/bin/phpunit --testdox # or composer test
Documentation
The package allows to create multi-root structures: no only-one-root! And allows to move nodes between trees.
Moreover, it also works with different model's primary key: int
, uuid
, ulid
.