Search package for Laravel

v2.1.0 2020-03-09 02:30 UTC

This package is auto-updated.

Last update: 2023-05-09 09:14:23 UTC


Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This is a search package built to easily integrate with Laravel. It uses a driver based system to abstract the internals of each specific search provider away from you. Currently only Elasticsearch is supported.

Why Not Use Scout?

There are 2 major differences between Scout and LaraSearch. First, Scout currently only has native support for Algolia, which is a service you pay for. They do have a free option, but this version has limits that will definitely be an issue for some. While Elasticsearch was originally supported, it was dropped due to complexity. There is a community effort to bring it back in as a native driver, but the road map on that is uncertain.

The second, and more important difference is that LaraSearch allows for 'site wide' searching, while Scout does not. In Scout, the searching is done on the models.


While this may be okay for some users, the far more common requirement is to be able to search an entire site. If a query is submitted for 'Andrew', I want to find the User Andrew, the Department he belongs to, and all of the Blog posts he has written. Additionally with LaraSearch, you are still able to restrict your search to a specific model if so desired.


$ composer require browner12/larasearch

If you are using the Elasticsearch driver, you must also install their package

$ composer require elasticsearch/elasticsearch


Add the service provider to the providers array in config/app.php.

'providers' => [

If you are using Laravel's auto-discovery, there is no need to complete this step.


You can publish everything at once

php artisan vendor:publish --provider="browner12\larasearch\LarasearchServiceProvider"

or you can publish groups individually.

php artisan vendor:publish --provider="browner12\larasearch\LarasearchServiceProvider" --tag="config"


Your desired driver is bound to a Searcher interface, so anyplace you wish to use LaraSearch that supports automatic dependency resolution, you can simply type hint the interface.

class SearchController
    public function index(Searcher $searcher)
        $results = $searcher->search('Andrew');

Please see the DOCUMENTATION for more in-depth explanations.

Change log

Please see CHANGELOG for more information on what has changed recently.


$ composer test


Please see CONTRIBUTING and CONDUCT for details.


If you discover any security related issues, please email instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.