PHPackages                             ahmetbarut/laravel-full-search - 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. ahmetbarut/laravel-full-search

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

ahmetbarut/laravel-full-search
==============================

Allows searching on multiple models. The advantage of this for us; a separate search field is not required for each model.

v1.1.0(3y ago)16MITPHPPHP &gt;=8.0

Since Apr 25Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ahmetbarut/laravel-full-search)[ Packagist](https://packagist.org/packages/ahmetbarut/laravel-full-search)[ RSS](/packages/ahmetbarut-laravel-full-search/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Laravel Full Search
===================

[](#laravel-full-search)

Allows searching on multiple models. The advantage of this for us; a separate search field is not required for each model.

[![Example](https://camo.githubusercontent.com/3fd66fc0968634823b9314d963985d06e0883d06a296c3a59b6cd91f1eae29d1/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f7562432d3945366c4c50552f302e6a7067)](https://www.youtube.com/watch?v=ubC-9E6lLPU)

Features
--------

[](#features)

- Mutli-model search
- Search on multiple fields
- definition of routes

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

[](#installation)

```
    composer require ahmetbarut/laravel-full-search
```

Configuration
-------------

[](#configuration)

All configurations related to the model are made from the `config/fullsearch.php` file.

### published config

[](#published-config)

```
    php artisan vendor:publish --provider="AhmetBarut\\LaravelFullSearch\\Providers\\LaravelFullSearchServiceProvider" --tag="fullsearch-config"
```

### view side

[](#view-side)

The `@stack('scripts')` directive must be defined on the view side, otherwise it will not work.

```

+

+    @stack('scripts')

```

> If you are using macos, you can open the search window with the cmd + K key combination.

Usage
-----

[](#usage)

You need to configure the `config/fullsearch.php` file for use.

```
    // config/fullsearch.php
use App\Models\Post;

return [
    'models' => [
        Post::class => [
            'searchable' => true,
            'ability' => false, // false or middleware name example: auth => 'auth',
            'searchable_fields' => [
                'title',
                'body',
                'id',
            ],
            'response_parameters' => [
                'title' => 'title',
                'page' => 'Posts',
            ],
            'route' => [
                'name' => 'post',
                'parameters' => [
                    'post' => 'id',
                ],
            ],
            'max_results' => 10,
        ],
    ],
];
```

In this way, you can search the `title`, `id` and `body` fields on the `Post` model. You can set the number of search results with the `max_results` parameter.

`searchable` =&gt; if `true` then search is possible. `ability` =&gt; if `false` then search is possible. If you want to restrict some models for certain users, you need to use `Laravel Gate`. I will explain it below. `searchable_fields` =&gt; specifies searchable fields. `response_parameters` =&gt; specifies the parameters to be displayed in the search result. `route` =&gt; specifies the routes to show in the search result. `max_results` =&gt; specifies the number of search results.

Restrict Specific Users
-----------------------

[](#restrict-specific-users)

```
    // app/Providers/AuthServiceProvider.php
use Illuminate\Support\Facades\Gate;

    public function boot()
    {
        $this->registerPolicies();

        Gate::define('admin', function ($user) {
            return $user->isAdmin();
        });
    }
```

```
    // config/fullsearch.php
use App\Models\User;

return [
    'models' => [
        User::class => [
            'searchable' => true,
            'ability' => 'admin',
            'searchable_fields' => [
                'name',
                'email',
                'id',
            ],
            'response_parameters' => [
                'name' => 'name',
                'page' => 'Users',
            ],
            'route' => [
                'name' => 'user',
                'parameters' => [
                    'user' => 'id',
                ],
            ],
            'max_results' => 10,
        ],
    ],
];
```

Users must have 'admin' authority to search on them. If you do not have admin privileges, you cannot search. It does not return an error message that it cannot search, it just returns an empty array.

Let's talk about `response_parameters` and `route['parameters']`. The `response_parameters` parameter specifies the parameters to be displayed in the search result. The `route['parameters']` parameter specifies the routes to be displayed in the search result. If you have noticed now, the `name` column has come across the `name` parameter in the `response_parameters`, so the `name` column will be shown as a return. If we want, we can `email` it.

```
    // config/fullsearch.php
    'searchable_fields' => [
        'name',
        'email',
        'id',
    ],
    'response_parameters' => [
-       'name' => 'name',
+       'name' => 'email',
        'page' => 'Users',
    ],
```

> The column to be displayed must be defined in `searchable_fields`.

Now let's deepen on `route['parameters']`. Similar usage exists in `response_parameters`.

```
...
        // config/fullsearch.php
    'searchable_fields' => [
        'name',
        'email',
        'id',
    ],
    'route' => [
        'name' => 'user',
        'parameters' => [
-           'user' => 'id',
+           'user' => 'email',
        ],
    ],
...
```

It will be like this `/user/user@email.com`.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Total

2

Last Release

1325d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/530008a3a5e32fa689343dc342c6686b50267ba86905e55e5f42ad2d1c8c193c?d=identicon)[ahmetbarut](/maintainers/ahmetbarut)

---

Top Contributors

[![ahmetbarut](https://avatars.githubusercontent.com/u/36641723?v=4)](https://github.com/ahmetbarut "ahmetbarut (8 commits)")

### Embed Badge

![Health badge](/badges/ahmetbarut-laravel-full-search/health.svg)

```
[![Health](https://phpackages.com/badges/ahmetbarut-laravel-full-search/health.svg)](https://phpackages.com/packages/ahmetbarut-laravel-full-search)
```

###  Alternatives

[mehradsadeghi/laravel-filter-querystring

Filter your queries based on url query string parameters like a breeze.

169118.2k](/packages/mehradsadeghi-laravel-filter-querystring)[pos-lifestyle/laravel-nova-date-range-filter

A Laravel Nova date range filter.

16179.1k](/packages/pos-lifestyle-laravel-nova-date-range-filter)

PHPackages © 2026

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