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

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

akkurateio/laravel-search
=========================

Search package for Laravel applications

v0.1.3(5y ago)02482AGPL-3.0-onlyPHP

Since Jan 12Pushed 5y ago2 watchersCompare

[ Source](https://github.com/akkurateio/laravel-search)[ Packagist](https://packagist.org/packages/akkurateio/laravel-search)[ RSS](/packages/akkurateio-laravel-search/feed)WikiDiscussions 0.x Synced 1mo ago

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

Laravel Search
==============

[](#laravel-search)

This package provides a search engine for Akkurate Laravel Boilerplate.

By default, the search is performed on specific fields of the Eloquent model via the Spatie [laravel-searchable](https://github.com/spatie/laravel-searchable) package.

If this is insufficient for the needs of the project, this package allows to set up an indexing in Elasticsearch.

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

[](#installation)

```
composer require akkurate/laravel-search
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="config"
```

Publish views:

```
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="views"
```

Publish the partial of the View component for Elasticsearch:

```
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="akk4search"
```

Publish entry views for the results page:

```
php artisan vendor:publish --provider="Akkurate\LaravelSearch\LaravelSearchServiceProvider" --tag="entries"
```

Eloquent
--------

[](#eloquent)

### Configuration

[](#configuration)

In the laravel-search configuration file, declare the models to search and the fields to search on:

```
'eloquent' => [
    'searchable' => [
        [
            'model' => \Akkurate\LaravelCore\Models\Account::class,
            'attributes' => ['name']
        ],
        [
            'model' => \Akkurate\LaravelCore\Models\User::class,
            'attributes' => ['firstname', 'lastname', 'email']
        ],
        [
            'model' => \Akkurate\LaravelBlog\Models\Article::class,
            'attributes' => ['title', 'overview', 'description']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Company::class,
            'attributes' => ['name', 'overview']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Contact::class,
            'attributes' => ['firstname', 'lastname', 'job']
        ],
        [
            'model' => \Akkurate\LaravelCrm\Models\Lead::class,
            'attributes' => ['reference', 'name', 'overview']
        ],
        [
            'model' => \Akkurate\LaravelFaq\Models\Question::class,
            'attributes' => ['title', 'content']
        ],
    ],
],
```

Elastic
-------

[](#elastic)

### Configuration

[](#configuration-1)

By default, the Elastic version is not active. In the app.js:

```
import Akk4Search from 'akk4search_vuejs';
Vue.use(Akk4Search);
```

then

```
npm run dev
```

In the .env:

```
// Akkurare For Search
AKKURATE_SEARCH_ENABLED=true

// Credentials
AKKURATE_SEARCH_KEY=your_api_key

// Activation of indexing (for Akkurate ecosystem models) on the model AKKURATE_SEARCH_PACKAGE_MODEL=bool
AKKURATE_SEARCH_ADMIN_USER=true
AKKURATE_SEARCH_ADMIN_ACCOUNT=true
AKKURATE_SEARCH_BLOG_ARTICLE=true
AKKURATE_SEARCH_BLOG_THEMATIC=true
AKKURATE_SEARCH_BOOKMARK_ITEM=true
AKKURATE_SEARCH_BOOKMARK_CATEGORY=true
AKKURATE_SEARCH_CONTACT_ADDRESS=true
AKKURATE_SEARCH_CONTACT_EMAIL=true
AKKURATE_SEARCH_CONTACT_PHONE=true
AKKURATE_SEARCH_CRM_COMPANY=true
AKKURATE_SEARCH_CRM_CONTACT=true
AKKURATE_SEARCH_CRM_LEAD=true
AKKURATE_SEARCH_DOCUMENTATION_=true
AKKURATE_SEARCH_DOCUMENTATION_=true
AKKURATE_SEARCH_FAQ_QUESTION=true
AKKURATE_SEARCH_GLOSSARY_TERM=true
AKKURATE_SEARCH_HELPDESK_CATEGORY=true
AKKURATE_SEARCH_HELPDESK_TICKET=true
AKKURATE_SEARCH_HELPDESK_MEDIA_RESOURCE=true

```

### Add an observer in the config file

[](#add-an-observer-in-the-config-file)

Create the observer

```
php artisan search:make:observer Example

```

By default, the model is supposed to be in App\\Models.

It is possible to change the path by providing a --namespace option. For example, if the model Example is in Package\\Models:

```
php artisan search:make:observer Example --namespace=Package\\Models

```

Fill in the url schema to reach the resource (to generate the link that will appear when the resource goes up in the search results).

For example:

```
"brain/{uuid}/admin/users/$user->id"

```

Add the declaration in the config file

```
'indexable' => [
    'my-custom-observer' => [
        'index' => true,
        'model' => \App\Models\AnyModel::class,
        'where' => [],
        'observer' => \App\Observers\Example::class,
        'route' => 'brain/{uuid}/admin/users'
        'key' => 'uuid'
        'name' => 'title',
        'suggest' => false,
        'env' => ['BACK'],
        'link' => 'show'
    ],
    ...
]

```

**index**: should the model be indexed or not.

**where**: in the `search:sync` command, if you don't want to send all the results to the Elastic database, it is possible to fill in a where clause, for example`['status' => 'active']`.

**route**: the resource access schema, to generate the url when using the CLI.

**key**: the field defined to access the resource. By default 'id' if absent, but can be set to 'uuid' or 'slug', etc. as needed.

**name**: the model field used to fill the name field in Elastic.

**suggest**: on FALSE the entry goes directly up in the results; on TRUE the entry does not go up in the results but is used to bring up related results.

**env**: the environment in which the results are to be reported.

**link**: the view to which the links for this model will point ('edit' or 'show').

### Entities

[](#entities)

A function in the model allows to define and update the entities (relations to be indexed) for a given model.

```
public function getEntities()
{
    return []; // logic to be defined for each model
}

```

Example: define an ACCOUNT entity on each USER. On the model App\\Models\\User :

```
public function getEntities()
{
    return [
            'uuid' => $this->account->searchable->uuid,
            'name' => $this->account->searchable->name,
        ];
}

```

### CLI

[](#cli)

#### Check the connection with akk4search

[](#check-the-connection-with-akk4search)

```
php artisan search:check

```

#### Display the list of observed models

[](#display-the-list-of-observed-models)

```
php artisan search:list

```

#### Synchronize data with the ElasticSearch database

[](#synchronize-data-with-the-elasticsearch-database)

```
php artisan search:sync

```

#### Test a keyword search

[](#test-a-keyword-search)

```
php artisan search:query subvitamine

```

#### Generate a new observer

[](#generate-a-new-observer)

```
php artisan search:make:observer

```

#### Delete data in the Elastic database

[](#delete-data-in-the-elastic-database)

```
php artisan search:clear

```

Removes all elastic data of the observed models (set to TRUE in the .env) + their SQL searchables

```
php artisan search:clear --all

```

Removes all the elastic data related to the account (relative to the key filled in the .env) + their SQL searchables.

```
php artisan search:clear --entities=ADMIN_ACCOUNT --entities=ADMIN_USER

```

Removes all elastic data related to the doctype(s). Searchables must be deleted manually.

```
php artisan search:clear --sync

```

Removes all elastic data from the observed models and performs a synchronization.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

5

Last Release

1938d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1033c0f3d0e9cebe3f9c63c293dbadcf26f46a90c467a8d66ce46621b243579?d=identicon)[camille-badique](/maintainers/camille-badique)

![](https://www.gravatar.com/avatar/2b35bce36f14b032c9ec57d12ff3b4719c02c85b41b0715e0d0279a6ce01dbf2?d=identicon)[dylanduault](/maintainers/dylanduault)

---

Top Contributors

[![cambad](https://avatars.githubusercontent.com/u/48125516?v=4)](https://github.com/cambad "cambad (5 commits)")[![zayfix](https://avatars.githubusercontent.com/u/38220718?v=4)](https://github.com/zayfix "zayfix (5 commits)")[![bastosh](https://avatars.githubusercontent.com/u/19573137?v=4)](https://github.com/bastosh "bastosh (2 commits)")[![Dylan-Duault](https://avatars.githubusercontent.com/u/1349678?v=4)](https://github.com/Dylan-Duault "Dylan-Duault (1 commits)")

### Embed Badge

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

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

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

PHP Client for OpenSearch

15024.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)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

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

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

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