> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Learn how to install Algolia Scout Extended.

export const ApplicationID = () => <Tooltip tip="A unique alphanumeric string that identifies an Algolia application." cta="Application ID (dashboard)" href="https://dashboard.algolia.com/account/api-keys">
    application ID
  </Tooltip>;

export const APIKey = () => <Tooltip tip="An alphanumeric string that controls access to the Algolia APIs. It defines what actions are allowed, such as searching an index or adding new records." cta="API key" href="/doc/guides/security/api-keys">
    API key
  </Tooltip>;

[Algolia Scout Extended](/doc/framework-integration/laravel/getting-started/introduction-to-scout-extended) requires the following PHP and Laravel versions:

| 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     |
| 1                      | 7.3 and later | 6               |

<Info>
  For more information, read the [Scout Extended changelog](https://github.com/algolia/scout-extended/blob/master/CHANGELOG.md).
</Info>

1. Install Scout Extended with Composer:

   ```sh Command line icon=square-terminal theme={"system"}
   # Install the latest version of Scout Extended
   composer require "algolia/scout-extended:^3.0"
   ```

2. Publish the Scout configuration to your `config` directory:

   ```sh Command line icon=square-terminal theme={"system"}
   php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
   ```

3. For the model you would like to make searchable,
   add the `Searchable` trait.
   For example, for an `Article` model (`app/Models/Article.php`):

   ```php PHP icon=code theme={"system"}
   namespace App\Models;

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

   class Article extends Model
   {
       use Searchable;
   }
   ```

   <Check>Replace `Article` with a model used in your app.</Check>

4. While not required, you should use a [queue driver](https://laravel.com/docs/11.x/queues) for Scout operations.
   After configuring a queue driver, set `queue` to `true` in your `config/scout.php` file:

   ```php PHP icon=code theme={"system"}
   'queue' => true,
   ```

5. To access Algolia, copy your credentials from the [Algolia dashboard](https://dashboard.algolia.com/account/api-keys/) to your [`.env` file](https://laravel.com/docs/11.x/configuration#environment-configuration):

   ```dotenv .env icon=lock-keyhole theme={"system"}
   ALGOLIA_APP_ID=# Your Algolia application ID
   ALGOLIA_SECRET=# Your Algolia API key with `search` and `addObject permissions`
   ```

6. To import existing data:

   * If you're importing from your Laravel database for the first time, [use `scout:import`](/doc/framework-integration/laravel/indexing/import-into-algolia).
   * If you've installed Scout Extended in a Laravel Scout project, [use `scout:reimport`](/doc/framework-integration/laravel/production/zero-downtime-reimports).

   <Note>If you make significant changes to your Scout configuration or need to reindex all your data, use `scout:reimport` to ensure everything is in sync.</Note>

7. Open the `routes/web.php` file and add the following route to the bottom of the file:

   ```php PHP icon=code theme={"system"}
   Route::get('search', function() {
       $query = ''; // <-- Change the query for testing.
       // Visit the /search route in your web browser to see articles that match the test $query.

       $articles = App\Article::search($query)->get();

       return $articles;
   });
   ```

   <Check>Replace `Article` with a model used in your app.</Check>
