PHPackages                             aminsamadzadeh/vispobish - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. aminsamadzadeh/vispobish

ActiveLibrary[Database &amp; ORM](/categories/database)

aminsamadzadeh/vispobish
========================

tree structure for eloquent models

v1.02(5y ago)111[1 issues](https://github.com/aminsamadzadeh/vispobish/issues)[3 PRs](https://github.com/aminsamadzadeh/vispobish/pulls)MITPHP

Since Jan 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/aminsamadzadeh/vispobish)[ Packagist](https://packagist.org/packages/aminsamadzadeh/vispobish)[ RSS](/packages/aminsamadzadeh-vispobish/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (7)Used By (0)

Vispobish
=========

[](#vispobish)

Add [tree structure](https://en.wikipedia.org/wiki/Tree_(data_structure)) to Eloquent models. In this package try to use optimize queries.

Installing
----------

[](#installing)

just run below command:

```
composer require aminsamadzadeh/simorgh
```

Usage
-----

[](#usage)

Create migration.

```
...
public function up()
{
	Schema::table('categories', function (Blueprint $table) {
		// vispobish pckage
		$table->string('path')->nullable(); // save path of tree
		$table->unsignedInteger('parent_id')->nullable();
		$table->foreign('parent_id')->references('id')->on('categories');
	});
}
...
```

Add `Treeable` trait to model.

```
...
use Illuminate\Database\Eloquent\Model;
use AminSamadzadeh\Vispobish\Treeable;

class Category extends Model
{
    use Treeable;
}
...
```

### Named Path

[](#named-path)

if you want save path with spicial name you can add `public $namedPathWith` property to your model and add `named_path` to migration.

```
...
public function up()
{
	Schema::table('categories', function (Blueprint $table) {
		$table->string('named_path')->unique(); // just used when set $pahtNamedWith
	});
}
...
```

```
...
class Category extends Model
{
    use Treeable;
    public $namedPathWith = 'name';
}
...
```

### Relationship

[](#relationship)

- `$cat->parent()` get parent
- `$cat->children()` get children
- `$cat->descendants()` get flatten children of childrens
- `$cat->ancestors()` get flatten all parents

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

3

Last Release

1932d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d20ce158dc3615c778a2838563fe591ef50e6a386afde9ca0428b4d5a813ee4?d=identicon)[amin](/maintainers/amin)

---

Top Contributors

[![aminsamadzadeh](https://avatars.githubusercontent.com/u/18627105?v=4)](https://github.com/aminsamadzadeh "aminsamadzadeh (12 commits)")

---

Tags

eloquentlaravelnested-settreetree-structure

### Embed Badge

![Health badge](/badges/aminsamadzadeh-vispobish/health.svg)

```
[![Health](https://phpackages.com/badges/aminsamadzadeh-vispobish/health.svg)](https://phpackages.com/packages/aminsamadzadeh-vispobish)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
