PHPackages                             devchithu/filter-sorting-searchable - 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. [Search &amp; Filtering](/categories/search)
4. /
5. devchithu/filter-sorting-searchable

ActivePackage[Search &amp; Filtering](/categories/search)

devchithu/filter-sorting-searchable
===================================

filter-sorting-searchable

v1.2.3(2y ago)1175MITPHPPHP ^8.0

Since Aug 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/chithresudev/filter-sorting-searchable)[ Packagist](https://packagist.org/packages/devchithu/filter-sorting-searchable)[ RSS](/packages/devchithu-filter-sorting-searchable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (20)Used By (0)

laravel Devchithu-Filter-Sorting-Searchable
===========================================

[](#laravel-devchithu-filter-sorting-searchable)

[![Latest Stable Version](https://camo.githubusercontent.com/872b83f74b85336c8689c96f9ded1747eddaa80075e20b1985f299139aa2cc62/687474703a2f2f706f7365722e707567782e6f72672f6465766368697468752f66696c7465722d736f7274696e672d73656172636861626c652f76)](https://packagist.org/packages/devchithu/filter-sorting-searchable) [![Total Downloads](https://camo.githubusercontent.com/e20d16ab8a5faaf1429d755caccf813df78dea9d8664620770dca206f5d23506/687474703a2f2f706f7365722e707567782e6f72672f6465766368697468752f66696c7465722d736f7274696e672d73656172636861626c652f646f776e6c6f616473)](https://packagist.org/packages/devchithu/filter-sorting-searchable) [![Latest Unstable Version](https://camo.githubusercontent.com/c483bbb5279d2ef3f7804839ce060da9f0e02f1b6a8d83a17864e18e0b19f067/687474703a2f2f706f7365722e707567782e6f72672f6465766368697468752f66696c7465722d736f7274696e672d73656172636861626c652f762f756e737461626c65)](https://packagist.org/packages/devchithu/filter-sorting-searchable) [![License](https://camo.githubusercontent.com/d0cbb44bae5ef492ec30fc57c27b52d699bcf2688986cfa592ebf21b04d07cea/687474703a2f2f706f7365722e707567782e6f72672f6465766368697468752f66696c7465722d736f7274696e672d73656172636861626c652f6c6963656e7365)](https://packagist.org/packages/devchithu/filter-sorting-searchable) [![PHP Version Require](https://camo.githubusercontent.com/6ae5360ad140d9633d4988c3cabfefbf2b4c81d93bcd92aa5e08ac8ef43c586d/687474703a2f2f706f7365722e707567782e6f72672f6465766368697468752f66696c7465722d736f7274696e672d73656172636861626c652f726571756972652f706870)](https://packagist.org/packages/devchithu/filter-sorting-searchable)

This Package bootstrap popover for handling dynamic switching column hidden, sorting, filter and searchable in Laravel.

[![Screenshot](public/filter_sort_searchable.gif)](public/filter_sort_searchable.gif)

Installation &amp; Usages
-------------------------

[](#installation--usages)

### Basic Setup

[](#basic-setup)

Install via composer; in console:

```
composer require devchithu/filter-sorting-searchable

```

or require in *composer.json*:

```
{
    "require": {
        "devchithu/filter-sorting-searchable": "^1.1.5"
    }
}
```

then run `composer update` in your terminal to pull it in.

Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:

path : project/config/app.php

Find ' providers =&gt; \[\] ' add inside below code (Custom Service Providers...)

```
Devchithu\FilterSortingSearchable\Providers\FilterSortingSearchableProvider::class,
```

Example like code : project/config/app.php

```
'providers' => [

    App\Providers\RouteServiceProvider::class,

    /*
     * Third Party Service Providers...
     */
    Devchithu\FilterSortingSearchable\Providers\FilterSortingSearchableProvider::class,
],
```

### Usages

[](#usages)

Use **FilterSortingSearchable** trait inside your *Eloquent* model(s).

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...
}
```

### Bootstrap 5 version

[](#bootstrap-5-version)

CSS File

```

```

JS File

```

```

Publish Js file
---------------

[](#publish-js-file)

then run publish cmd you must to publish only js file and where-ever your want 'filter, sort, searchable' using the below script in blade.php file

```
php artisan vendor:publish --tag=filter-sorting-searchable

```

See public/filter-sorting-searchable.js (if you want any change update this code inside)

Method of design filter sorting extension
=========================================

[](#method-of-design-filter-sorting-extension)

#### 1. Bootstrap Popover filter sorting Blade Extension

[](#1-bootstrap-popover-filter-sorting-blade-extension)

1. Bootstrap Popover filter sorting Blade Extension
---------------------------------------------------

[](#1-bootstrap-popover-filter-sorting-blade-extension-1)

Must push that js file in blade, where-ever your want like (better than push that js file into main index blade.php):

```

```

OR,

```
@push('scripts')

@endpush

```

\* Sorting
----------

[](#-sorting)

There is a blade extension for you to use **@filterSort()**

```
@filterSort(['sorting' => true, 'field_name' => 'name'])
```

**Custom field name sorting**

```
@filterSort(['sorting' => true,'field_name' => 'name', 'label_name' => 'Name'])
```

**Custom label(Ascending and descending) name change**

```
@filterSort(['sorting' => true, 'field_name' => 'name', 'label_name' => 'Name', 'sorting_custom_label' => ['low to high', 'high to low']])
```

**Here**,

1. `sorting` parameter default is false. `true` is sorting enabled, if don't need sorting just put `false` or just remove sorting field.
2. `field_name` parameter is column in database table field, **name**.
3. `label_name` parameter is displayed inside anchor tags and print valueable field name. incase of `label_name` doe'st use automatically get column in database table field.
4. `sorting_custom_label` parameter change default name like : 'Sort Ascending' into 'low to high' , 'Sort Descending' into 'high to low'

**what are field sorting declare the using your *Eloquent* model(s) inside function like below code**,

Use **FilterSortSearchable** trait inside your *Eloquent* model(s).

### *Eloquent* model

[](#eloquent-model)

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...

    /**
     * The table sorting order asc and desc.
     *
     * @var string
     */

    public $sorting = [
        'id',
        'name',
        'email',
        'created_at',
    ];

}
```

### Controller's `index()` method

[](#controllers-index-method)

```
public function index(Request $request)
{
    $users = User::sorting()->get();

    return view('user.index', ['users' => $users]);
}
```

\* Inline Filter
----------------

[](#-inline-filter)

***Blade table config***

There is a sorting similar same blade extension for you to use **@filterSort()**

```
 @filterSort(['filter' => true, 'type' => 'text', 'field_name' => 'instance_type'])
```

**Custom field name change filter**

```
@filterSort(['filter' => true, 'type' => 'text',  'field_name' => 'name', 'label_name' => 'Name'])
```

**Custom design filter**Here, Custom design when anything you want design put the code like below,

```
@filterSort(['filter' => true, 'type' => 'text',  'field_name' => 'name', 'label_name' => 'Name', 'custom_design' => '

'])
```

**Custom design only filter**Here, Type is not mentioned, if you want new design apply Custom design when anything you want design put the code like below,

```
@filterSort(['filter' => true, 'field_name' => 'name', 'label_name' => 'Name', 'custom_design' => '

'])
```

**what are field filterable declare the using your *Eloquent* model(s) inside function like below code**,

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...

    /**
     * The table filter order asc and desc.
     *
     * @var string
     */

     public $filterable = [
        'id',
        'name',
        'email'
    ];

}
```

### Controller's `index()` method

[](#controllers-index-method-1)

```
public function index(Request $request)
{
    $users = User::filterable()->get();

    return view('user.index', ['users' => $users]);
}
```

Sorting &amp; Filter
--------------------

[](#sorting--filter)

Incase, If you want sort and filter sametime using below Code,

```
 @filterSort(['sotring' => true, 'filter' => true, 'type' => 'text', 'field_name' => 'status_type', 'label_name' => 'Status Type '])
```

**Here**,

1. `filter` parameter default is false. `true` is filter enabled, if don't need filter just put `false` or just remove filter parames.
2. `field_name` parameter is column in database table field, **name**.
3. `label_name` parameter is displayed inside anchor tags and print valueable field name. incase of `label_name` doe'st use automatically get column in database table field.

**UI - filter input field automatically generate**

1. filter is `true` create input box type = 'text', if you want different input type like (selelect, radio, range) below code put the array params `'type' => 'text' // 'type' => 'select' or  radio, range`

Here, if you `select ` option using multiple option value data like `'multiple\_option' =&gt; \['All', 'active', 'in\_active'\]

```
 @filterSort(['sorting' => true, 'filter' => true, 'type' => 'select', 'field_name' => 'status', 'label_name' => 'Status', 'multiple_option' => ['All', 'active', 'in_active']])

```

**what are field sorting and filter declare the using your *Eloquent* model(s) inside function like below code**,

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...

    /**
     * The table sorting order asc and desc.
     *
     * @var string
     */

    public $sorting = [
        'id',
        'name',
        'email',
        'created_at',
    ];

    /**
     * The table filter.
     *
     * @var string
     */

     public $filterable = [
        'id',
        'name',
        'email'
    ];

}
```

### Controller's `index()` method

[](#controllers-index-method-2)

```
public function index(Request $request)
{
    $users = User::sorting()->filterable()->get();

    return view('user.index', ['users' => $users]);
}
```

### Controller's `index()` method with paginate()

[](#controllers-index-method-with-paginate)

```
public function index(Request $request)
{
    $users = User::sorting()->filterable()->paginate(20);

    return view('user.index', ['users' => $users]);
}
```

\*Searchable
------------

[](#searchable)

This searchable global area find the table data

**what are field searchable declare the using your *Eloquent* model(s) inside function like below code**,

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...

    /**
     * The table searchable.
     *
     * @var string
     */

     public $searchable = [
        'id',
        'name',
        'email'
    ];

}
```

There is a blade extension for you to use **@searchable()**

```
@searchable()
```

### Controller's `index()` method

[](#controllers-index-method-3)

```
public function index(Request $request)
{
    $users = User::searchable()->get();

    return view('user.index', ['users' => $users]);
}
```

### Controller's `index()` method

[](#controllers-index-method-4)

If you want filter, sorting, searchable declare the scope function

```
public function index(Request $request)
{
    $users = User::sorting()->filterable()->searchable()->get();

    return view('user.index', ['users' => $users]);
}
```

\*Manual customized filter
==========================

[](#manual-customized-filter)

If you want filter some field customazed used here file

```
php artisan vendor:publish --tag=customFilterTrait

```

See app\\CustomFilter\\CustomFilterTrait.php (if you want any change update this code inside)

**what are the customized filter field don't declare (filterable) array. declare custom filterable the using your *Eloquent* model(s) inside function**,

```
use Devchithu\FilterSortingSearchable\Traits\FilterSortingSearchable;

class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
    use Authenticatable, CanResetPassword, FilterSortingSearchable;
    ...
    ...

    /**
     * The table filter.
     *
     * @var string
     */

     public $customfilterable = [
            'name',
            'status',
    ];

}
```

\* Binding Params
-----------------

[](#-binding-params)

What are field sorting, searching and filterting below code Which place to you want binding parameters declare the **@bindingParams()**

```
@bindingParams()
```

\* Binding Params apply custom style class
------------------------------------------

[](#-binding-params-apply-custom-style-class)

What are field sorting, filterting below code Which desgin you want apply the class name like :

```
@bindingParams(['sorting_style_class' => 'custom-sorting', 'filter_style_class' => 'custom-filter'])
```

\* Table Column Dynamic hidden switcher
---------------------------------------

[](#-table-column-dynamic-hidden-switcher)

what are the field you want default show put here every table column menu icon '...' :

```
 @tableColumnSwitcher()
```

if you want only one field need hide:

```
 @filterSort(['label_name' => 'id', 'table_column_switcher' => 'default'])
```

if you want also filter, sorting, searchable, table column hidden:

```
@filterSort(['sorting' => true, 'filter' => true, 'field_name' => 'id', 'label_name' => 'ID', 'table_column_switcher' => 'default'])
```

here, two option is there. one is table\_column\_switcher 'default' this can't change the column. second is table\_column\_switcher is 'true' you can change the column.

```
Run finally,
```
php artisan op:cl
```

Thank you .

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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 ~10 days

Recently: every ~26 days

Total

19

Last Release

818d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7eab3d27fa3a59c587fe7d2a696627568eafb2099edf572bfd4b0860814f1f9c?d=identicon)[chithresudev](/maintainers/chithresudev)

---

Top Contributors

[![chithresuganesan](https://avatars.githubusercontent.com/u/40829565?v=4)](https://github.com/chithresuganesan "chithresuganesan (7 commits)")[![chithresudev](https://avatars.githubusercontent.com/u/40000188?v=4)](https://github.com/chithresudev "chithresudev (3 commits)")

### Embed Badge

![Health badge](/badges/devchithu-filter-sorting-searchable/health.svg)

```
[![Health](https://phpackages.com/badges/devchithu-filter-sorting-searchable/health.svg)](https://phpackages.com/packages/devchithu-filter-sorting-searchable)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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