PHPackages                             siberfx/typesense-scout - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. siberfx/typesense-scout

ActiveLibrary[Search &amp; Filtering](/categories/search)

siberfx/typesense-scout
=======================

Laravel Scout Driver for Typesense

1.1.2(6mo ago)01.0k↓21.9%MITPHPPHP ^8.3

Since Jun 11Pushed 1mo agoCompare

[ Source](https://github.com/siberfx/typesense-scout)[ Packagist](https://packagist.org/packages/siberfx/typesense-scout)[ Docs](https://typesense.org)[ RSS](/packages/siberfx-typesense-scout/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (8)Versions (7)Used By (0)

Laravel Scout Typesense Driver
==============================

[](#laravel-scout-typesense-driver)

This package makes it easy to add full text search support to your models with Laravel 12+.

Important

The features from the Scout driver in this repo have been merged upstream into [Laravel Scout natively](https://laravel.com/docs/11.x/scout#typesense).

So we've temporarily paused development in this repo and plan to instead address any issues or improvements in the native [Laravel Scout](https://github.com/laravel/scout) driver instead.

If there are any Typesense-specific features that would be hard to implement in Laravel Scout natively (since we need to maintain consistency with all the other drivers), then at that point we plan to add those features into this driver and maintain it as a "Scout Extended Driver" of sorts. But it's too early to tell if we'd want to do this, so we're in a holding pattern on this repo for now.

In the meantime, we recommend switching to the native Laravel Scout driver and report any issues in the [Laravel Scout repo](https://github.com/laravel/scout).

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [Migrating from siberfx/typesense-scout](#migrating-from-siberfx-typesense)
- [Authors](#authors)
- [License](#license)

Installation
------------

[](#installation)

The Typesense PHP SDK uses httplug to interface with various PHP HTTP libraries through a single API.

First, install the correct httplug adapter based on your `guzzlehttp/guzzle` version. For example, if you're on Laravel 8, which includes Guzzle 7, then run this:

```
composer require php-http/guzzle7-adapter
```

Then install the driver:

```
composer require siberfx/typesense-scout
```

And add the service provider:

```
// config/app.php
'providers' => [
    // ...
    Siberfx\Typesense\TypesenseServiceProvider::class,
],
```

Ensure you have Laravel Scout as a provider too otherwise you will get an "unresolvable dependency" error

```
// config/app.php
'providers' => [
    // ...
    Laravel\Scout\ScoutServiceProvider::class,
],
```

Add `SCOUT_DRIVER=typesense` to your `.env` file

Then you should publish `scout.php` configuration file to your config directory

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

In your `config/scout.php` add:

```
'typesense' => [
    'api_key'         => 'abcd',
    'nodes'           => [
      [
        'host'     => 'localhost',
        'port'     => '8108',
        'path'     => '',
        'protocol' => 'http',
      ],
    ],
    'nearest_node'    => [
        'host'     => 'localhost',
        'port'     => '8108',
        'path'     => '',
        'protocol' => 'http',
    ],
    'connection_timeout_seconds'   => 2,
    'healthcheck_interval_seconds' => 30,
    'num_retries'                  => 3,
    'retry_interval_seconds'       => 1,
  ],
```

Usage
-----

[](#usage)

If you are unfamiliar with Laravel Scout, we suggest reading it's [documentation](https://laravel.com/docs/12.x/scout) first.

After you have installed scout and the Typesense driver, you need to add the `Searchable` trait to your models that you want to make searchable. Additionaly, define the fields you want to make searchable by defining the `toSearchableArray` method on the model and implement `TypesenseSearch`:

```
