PHPackages                             alohajaycee/laravel-traversify - 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. alohajaycee/laravel-traversify

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

alohajaycee/laravel-traversify
==============================

easy traverse eloquent models

v2.2.17(2mo ago)3732[4 issues](https://github.com/jayceedaily/laravel-traversify/issues)MITPHPCI passing

Since Jun 17Pushed 2mo agoCompare

[ Source](https://github.com/jayceedaily/laravel-traversify)[ Packagist](https://packagist.org/packages/alohajaycee/laravel-traversify)[ RSS](/packages/alohajaycee-laravel-traversify/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (1)Versions (33)Used By (0)

Traversify
==========

[](#traversify)

[![Total Downloads](https://camo.githubusercontent.com/a56deef45420aef0c7aa32f4388b457d5ef478c8b68381d8a9f879e1bae859d7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6f68616a61796365652f6c61726176656c2d747261766572736966792e737667)](https://packagist.org/packages/alohajaycee/laravel-traversify)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/93fce63ca8cceb6a1d31ffd0c4c2fb875669d137f33b399061ba6b9450d8892b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c6f68616a61796365652f6c61726176656c2d747261766572736966792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alohajaycee/laravel-traversify/?branch=master)

Installation
------------

[](#installation)

**Composer**

Install via composer using `composer require jayceedaily/laravel-traversify`

**Model setup**

```
use Traversify/Traversify;
use Traversify/Traversable;

use Eloquent;

class Task extends Eloquent implements Traversable {
	use Traversify;

    // Configure the fields to be searched
    protected $search = [
        'name', 'description'
    ];

    // Configure the fields to be sorted
    protected $sort = [
        'created_at', 'name', 'completed_at'
    ];

    // Configure the fields to be filtered
    protected $filter = [
        'type_id', 'status'
    ];

}
```

**Controller Setup**

```
use MyModel

class MyController {

     public function index() {

          return MyModel::traversify();

     }
}
```

Configure
---------

[](#configure)

To use a search like function, you must create a static variables and assign an array containing an array of the fields that needed to be searched. These are the following:

- $searchables
- $filterables
- $orderables
- $rangables

### Search

[](#search)

This uses a **%keyword%** approach in sql. Traversify currently does not support scout or any advance search engine. For basic usage, this is more than enough.

```
use Traversify/Traversify;

    class MyModel {

    	use Traversify;

        public static $searchables = ['title', 'description']
    }
```

### Filter

[](#filter)

Use filter for foreign key values of tables. This will only pull data whose foreign key values matches the requested filter.

```
use Traversify/Traversify;

    class MyModel {

    	use Traversify;

        public static $filterables = ['status_id', 'is_active']
    }
```

### Order / Sort

[](#order--sort)

Can sort fields with number, letters, but is commonly used on dates which is also supported.

```
use Traversify/Traversify;

    class MyModel {

    	use Traversify;

        public static $orderables = ['created_at', 'is_active']
    }
```

### Range

[](#range)

Show records only that has values within the requested values. Requires 2 values, start &amp; end.

```
use Traversify/Traversify;

    class MyModel {

    	use Traversify;

        public static $rangables = ['created_at', 'price']
    }
```

### Custom

[](#custom)

For added custom query/s you can pass a query function inside `traversify()`. This is then combined to the existing queries that traversify already uses.

```
use MyModel;

class MyController {

     public function index()
     {
          return MyModel::traversify(function($q){

               $q->where('is_active', TRUE);

          });
     }
}
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance63

Regular maintenance activity

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 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 ~78 days

Recently: every ~399 days

Total

32

Last Release

89d ago

Major Versions

v1.0.8 → v2.0.12021-07-20

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25096029?v=4)[Jaycee Daily](/maintainers/jayceedaily)[@jayceedaily](https://github.com/jayceedaily)

---

Top Contributors

[![jayceedaily](https://avatars.githubusercontent.com/u/25096029?v=4)](https://github.com/jayceedaily "jayceedaily (67 commits)")

---

Tags

composerfilterlaravelrangesort

### Embed Badge

![Health badge](/badges/alohajaycee-laravel-traversify/health.svg)

```
[![Health](https://phpackages.com/badges/alohajaycee-laravel-traversify/health.svg)](https://phpackages.com/packages/alohajaycee-laravel-traversify)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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