New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

open-southeners/laravel-scout-advanced-meilisearch

Advanced Meilisearch integration with Laravel Scout
1,001 5
Install
composer require open-southeners/laravel-scout-advanced-meilisearch
Latest Version:5.2.0
PHP:^8.2
Laravel:11 · 12 · 13
Older releases:8 · 9 · 10
License:MIT
Last Updated:Oct 18, 2026
Links: GitHub  ·  Packagist
Maintainer: d8vjork

Laravel Scout Advanced Meilisearch required php version codecov Edit on VSCode online

Advanced Meilisearch integration with Laravel Scout.

Getting started

Install the package using Composer:

composer require open-southeners/laravel-scout-advanced-meilisearch

Filterable and sortable attributes

For sending filterable and sortable attributes to your Meilisearch server, configure your already searchable models like so:

use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Tag extends Model
{
    use Searchable;

    /**
     * Get the indexable data array for the model.
     *
     * @return array
     */
    public function toSearchableArray()
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'slug' => $this->slug,
        ];
    }

    /**
     * Get the search sortable attributes array for the model.
     *
     * @return array<string>
     */
    public function searchableFilters(): array
    {
        return ['name'];
    }

    /**
     * Get the search sortable attributes array for the model.
     *
     * @return array<string>
     */
    public function searchableSorts(): array
    {
        return ['slug'];
    }
}
Using PHP attributes

In case your project is using PHP 8, you can do this by attributes on the model class or the toSearchableArray method:

use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Scout\Searchable;
use OpenSoutheners\LaravelScoutAdvancedMeilisearch\Attributes\ScoutSearchableAttributes;

#[ScoutSearchableAttributes(filterable: ['email'], sortable: ['name'])]
class User extends Authenticatable
{
    use Searchable;

    /**
     * Get the indexable data array for the model.
     *
     * @return array
     */
    public function toSearchableArray()
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'email' => $this->email,
        ];
    }
}

And finally run the following artisan command:

php artisan scout:update "App\Models\User"

You could also run this command with --wait option which tells the command to wait for the task to finish:

php artisan scout:update "App\Models\User" --wait

Remember to check the official documentation about these filters and sorts.

Dumps

Create Meilisearch data dumps (data backups that will be saved on your Meilisearch server), with the following command:

php artisan scout:dump

As scout:update command, this also have a --wait option:

php artisan scout:dump --wait

Read more about Meilisearch dumps here.

Tasks

List all tasks via command line, just running the following:

php artisan scout:tasks

They can be even filtered! (see more options running it with --help)

php artisan scout:tasks --status=succeeded
Canceling enqueued tasks

Also can cancel tasks with a very simple command, you can either cancel an specific task or multiple:

php artisan scout:tasks-cancel 1

The previous command will cancel task with UID = 1. If you wish to cancel multiple you could send them separated by comma or using options like:

php artisan scout:tasks-cancel --before-enqueued=1d

So this will cancel all tasks that were enqueued before 1 day (can also send 1m, 1y... as in the background this is using Carbon::now()->add() & Carbon::now()->sub() methods)

Prune finished tasks

As canceling tasks won't make them disappear from the tasks history, you can just run the following:

php artisan scout:tasks-prune

Just for safety for debug purposes, this command does not remove those tasks that failed, if you wish to do so, run the command with --include-failed like so:

php artisan scout:tasks-prune --include-failed

Don't worry, this will not remove tasks that were enqueued and not finished, as stated by Meilisearch official docs (see link just below).

Read more about Meilisearch tasks here.

Partners

skore logo

License

This package is open-sourced software licensed under the MIT license.

Related Packages

statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

105,031 16
croox/statamic-meilisearch-extendable

Extendable Statamic Meilisearch search driver

1,936 1
omure/scout-advanced-meilisearch

Laravel Scout extension that allows to use meilisearch advanced features as well...

3,870 12
algolia/laravel-scout-algolia-macros

A collection macros to extend Laravel Scout with more Algolia capabilities

33,802 36
aedart/athenaeum-filters

Search filter utilities, based on http query parameters

2,599 0

Version History

Version Released PHP Laravel License
5.2.0 ^8.2 ^11.0 || ^12.0 || ^13.0 MIT
5.1.0 ^8.2 ^11.0 || ^12.0 MIT
5.0.0 ^8.2 ^11.0 || ^12.0 MIT
4.1.0 ^8.0 ^9.0 || ^10.0 || ^11.0 MIT
4.0.0 ^8.0|^8.1|^8.2 ^9.0|^10.0 MIT