Framework integration / Laravel / Getting started


The following versions of PHP and Laravel are required for Scout Extended.

Scout Extended version PHP version Laravel version
3 8.1 and later 10 and later
  8.0 and later 9 and later
2 7.3 and later 8 and later

For Laravel version 6, use version 1 of Scout Extended.

Make sure to read the Scout Extended changelog when upgrading from version 1 to version 2.


First, install Scout Extended with the Composer package manager:

composer require "algolia/scout-extended:^2.0"

If you’re installing Scout Extended in a project that already includes Laravel Scout, you must reimport your data using the php artisan scout:reimport command.

After installing Scout Extended, you should publish the Scout configuration using the php artisan vendor:publish command. This command publishes the scout.php configuration file to your config directory:

php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"

Lastly, add the Laravel\Scout\Searchable trait to the model you would like to make searchable. This trait registers a model observer to keep the model in sync with Algolia:

namespace App;

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

class Article extends Model
    use Searchable;

While not required, you should use the queue driver for Scout operations. Once you’ve configured a queue driver, set the value of the queue option in your config/scout.php configuration file to true:

'queue' => true,

Configure API keys

Replace these placeholders in your .env file with your values. You can find them in the Algolia dashboard.

  • <ALGOLIA_APP_ID>. Your Algolia application ID.
  • <ALGOLIA_API_KEY>. Your API key with search and addObject permissions.

Your Admin API key grants full access to your Algolia application. You should never share it with anyone, and it must remain confidential.

Did you find this page helpful?