New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

umbrellio/laravel-ltree

Extension LTree (Postgres) for Laravel
128,368 35
Install
composer require umbrellio/laravel-ltree
Latest Version:8.1.0
PHP:^8.3|^8.4
Laravel:11
Older releases:5 – 10
License:MIT
Last Updated:Apr 22, 2026
Links: GitHub  ·  Packagist
Maintainer: pvsaintpe

laravel-ltree

Github Status Coverage Status Latest Stable Version Total Downloads Code Intelligence Status Build Status Code Coverage Scrutinizer Code Quality

LTree Extension (PostgreSQL) for Laravel.

Installation

Run this command to install:

php composer.phar require umbrellio/laravel-ltree

How to use

Implement your Eloquent\Model from LTreeModelInterface and use LTreeModelTrait.

Use LTreeService for build path:

  1. when create model: createPath(LTreeModelInterface $model)
  2. when update model: updatePath(LTreeModelInterface $model) for update path for model and children
  3. when delete model: dropDescendants(LTreeModelInterface $model) for delete children models

The get() method returns LTreeCollection, instead of the usual Eloquent\Collection.

LTreeCollection has a toTree() method that converts a flat collection to a tree.

LTreeResourceCollection & LTreeResource, which take LTreeCollection as an argument, will also be useful.

Authors

Created by Korben Dallas.

Supported by Umbrellio

Related Packages

sunaoka/php-postgresql-errors

PostgreSQL Error Codes

37,774 6
asmiarowski/laravel-postgres

Eloquent support for postgreSQL fields

38,412 15
forrest79/phpgsql

PostgreSQL library for PHP with fluent interface for SQL query writing.

9,742 15
efureev/laravel-trees

Multi-Tree structures for Laravel

65,946 144

Version History

Version Released PHP Laravel License
8.1.0 ^8.3|^8.4 ^11.0 MIT
8.0.1 ^8.3|^8.4 ^11.0 MIT
8.0.0 ^8.3|^8.4 ^11.0 MIT
7.6.0 ^7.3|^7.4|^8.0|^8.1|^8.2 ^5.8|^6.20.26|^7.0|^8.40|^9.0|^10.0|^11.0 MIT
7.5.2 ^7.3|^7.4|^8.0|^8.1|^8.2 ^5.8|^6.20.26|^7.0|^8.40|^9.0|^10.0|^11.0 MIT