PHPackages                             dzava/global-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. dzava/global-search

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

dzava/global-search
===================

0.1.0(6y ago)02MITPHPPHP ^7.1CI failing

Since Oct 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/dzava/global-search)[ Packagist](https://packagist.org/packages/dzava/global-search)[ Docs](https://github.com/dzava/global-search)[ RSS](/packages/dzava-global-search/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

GlobalSearch
============

[](#globalsearch)

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

[](#installation)

You can install the package via composer:

```
composer require dzava/global-search
```

Optionally publish the config:

```
php artisan vendor:publish --tag=config --provider="Dzava\GlobalSearch\GlobalSearchServiceProvider"
```

Usage
-----

[](#usage)

Add the `searchableFields` method to searchable models.

```
class User extends Model {
	public function searchableFields() {
    	return ['name'];
    }
}

class Post extends Model {
	public function searchableFields() {
    	return ['title'];
    }
}
```

Perform a search

```
use Dzava\GlobalSearch\GlobalSearch;

$results = (new GlobalSearch())->withModels([User::class, Post::class])->search('Doe');

//  [
//      'users' => [
//          ['name' => 'John Doe', 'email' => 'john@example.com'],
//          ['name' => 'Jane Doe', 'email' => 'jane@example.com']
//  ],
//      'posts'  => [
//          ['title' => 'Who is John Doe', 'slug' => 'who-is-john-doe'
//      ]
//  ]
```

To limit the number of results per model use the `limit($limit)` method. Given a limit of 0 all matching results are returned.

If no matching records are found for a model then the group is omitted from the results. To include empty groups use the `withEmpty()` method.

You can override the default group key when registering the models

```
GlobalSearch::registerModels(['Accounts' => User::class, Post::class]);
```

If you don't want to group the results use the `withoutGroups()` method.

### Formatting the results

[](#formatting-the-results)

Results are formatted using the `toArray` method of the model. You can use a different method by changing the `toArray` option in the config file. If the method is missing from the model then it will fallback to `toArray`.

You can disable formatting entirely with the `withoutFormatting()` method, in which case the model is returned.

### Customizing the query

[](#customizing-the-query)

You can customize the search query by implementing the `searchQuery` method in your models. The method will receive two parameters, the query Builder instance and the search term, and it should return the query to be executed.

When a model uses the `Laravel\Scout\Searchable` trait scout will be used automatically.

### Authorization

[](#authorization)

The package will use Laravel's authorization policies, when available. If a policy is found, then the policy's authorization method is checked. You can change the authorization method used by setting the `policy-method` config option.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

2410d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5c257b625706f22f168252097c508646c5043227ea557da551221702702ccea?d=identicon)[dzava](/maintainers/dzava)

---

Top Contributors

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

---

Tags

searchlaravelglobal

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dzava-global-search/health.svg)

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

###  Alternatives

[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

397612.3k](/packages/jeroen-g-explorer)[devnoiseconsulting/laravel-scout-postgres-tsvector

PostgreSQL Full Text Search Driver for Laravel Scout

58110.1k](/packages/devnoiseconsulting-laravel-scout-postgres-tsvector)

PHPackages © 2026

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