Installation
Requirements
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.
Installation
First, install Scout Extended via 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:
1
2
3
4
5
6
7
8
9
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:
1
'queue' => true,
Configure API keys
Add the credentials, ALGOLIA_APP_ID and ALGOLIA_SECRET, to your .env file:
$
$
ALGOLIA_APP_ID=YourApplicationID
ALGOLIA_SECRET=YourAdminAPIKey
Your Admin API key grants full access to your Algolia application. You should never share it with anyone, and it must remain confidential.