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

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

shankar/laravel-search
======================

Global search across Laravel models and relationships.

v1.0.0(10mo ago)06MITPHPPHP ^8.0

Since Jul 1Pushed 9mo agoCompare

[ Source](https://github.com/Shankar-Tom/laravel-search)[ Packagist](https://packagist.org/packages/shankar/laravel-search)[ RSS](/packages/shankar-laravel-search/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Global Search
=====================

[](#laravel-global-search)

A Laravel package for global search and Eloquent models and their relationships.

Features
--------

[](#features)

- Search across multiple Eloquent models
- Supports searching related models
- Easy integration with Laravel projects
- Configurable model paths and exclusions

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

[](#installation)

```
composer require shankar/laravel-search
```

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

[](#configuration)

Publish the config file (optional):

```
php artisan vendor:publish --provider="Shankar\LaravelSearch\SearchServiceProvider"
```

This will create a `config/globalsearch.php` file where you can customize:

- `model_path`: Path to your models directory (default: `app/Models`)
- `model_namespace`: Namespace for your models (default: `App\Models\`)
- `all_model_search`: Whether to search all models in the directory
- `searchable_models`: Specific models to include (if not searching all)
- `exclude`: Models to exclude from search

Usage
-----

[](#usage)

### 1. Add the `Searchable` Trait to Your Model

[](#1-add-the-searchable-trait-to-your-model)

```
use Shankar\LaravelSearch\Traits\Searchable;

class Post extends Model
{
    use Searchable;

    public $searchable = true;
    public $searchable_fields = ['title', 'content'];

    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
```

### 2. Searching in Your Controller

[](#2-searching-in-your-controller)

You can perform a global search using the facade or the class directly:

```
use Shankar\LaravelSearch\Facades\GlobalSearch;

$results = GlobalSearch::search('search term');
```

Or, if you want to use the trait's local scope for a specific model:

```
$posts = Post::search('search term')->get();
```

### 3. Searching Related Models

[](#3-searching-related-models)

You can also search related models using the `searchRelations` scope:

```
$posts = Post::searchRelations([
    'user' => ['name', 'email'],
], 'search term')->get();
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance56

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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

Unknown

Total

1

Last Release

316d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f9304ceaf3382f46907e0681ef12d2298aad590816930c580631707bf245348?d=identicon)[Shankar-Tom](/maintainers/Shankar-Tom)

---

Top Contributors

[![Shankar-Tom](https://avatars.githubusercontent.com/u/68939188?v=4)](https://github.com/Shankar-Tom "Shankar-Tom (5 commits)")

### Embed Badge

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

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

###  Alternatives

[mailerlite/laravel-elasticsearch

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

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[swisnl/laravel-fulltext

Fulltext indexing and searching for Laravel

184104.5k6](/packages/swisnl-laravel-fulltext)[romanstruk/manticore-scout-engine

Laravel Manticore Scout Engine

4818.1k](/packages/romanstruk-manticore-scout-engine)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)[internachi/blade-alpine-instantsearch

Algolia instant search as Blade/Alpine.js components

1940.9k](/packages/internachi-blade-alpine-instantsearch)

PHPackages © 2026

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