PHPackages                             elvenstar/statamic-typesense - 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. elvenstar/statamic-typesense

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

elvenstar/statamic-typesense
============================

Typesense driver for Statamic v3 search engine

0.1.1(4y ago)11201[1 PRs](https://github.com/elvenstar/statamic-typesense/pulls)PHP

Since Jun 15Pushed 3y ago2 watchersCompare

[ Source](https://github.com/elvenstar/statamic-typesense)[ Packagist](https://packagist.org/packages/elvenstar/statamic-typesense)[ RSS](/packages/elvenstar-statamic-typesense/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Statamic Typesense Search Driver
================================

[](#statamic-typesense-search-driver)

Typesense is a *relatively new* search engine and the driver code may change as new features are developed. This is still very much a beta or preview until the next typesense release when some of the quirks will be fixed.

***Disclaimer: It's a dev release. I would not recommend using this in production until more testing has been done and some core bugs have been resolved.***

### Installation

[](#installation)

```
composer require elvenstar/statamic-typesense
```

The Typesense library also requires a Guzzle adapter, install the appropriate one according to which Guzzle version that Laravel uses.

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

Publish the `typesense.php` config file we will use for configuration:

```
php artisan vendor:publish --tag="statamic-typesense"

```

Add the following variables to your env file:

```
TYPESENSE_API_KEY=
TYPESENSE_URL=localhost     // For Typesense Cloud use xxx.a1.typesense.net
TYPESENSE_PORT=8108         // For Typesense Cloud use 443
TYPESENSE_PROTOCOL=http     // For Typesense Cloud use https
```

Add the new driver to the `statamic.search` config file:

```
    'drivers' => [

        // other drivers

        'typesense' => [
            'credentials' => [
                'api_key' => env('TYPESENSE_API_KEY', ''),
                'nodes' => [
                    'host' => env('TYPESENSE_URL', ''),
                ],
                'port' => env('TYPESENSE_PORT', '443'),
                'protocol' => env('TYPESENSE_PROTOCOL', 'https'),
                'nearest_node' => env('TYPESENSE_NEAREST_NODE', null),
                'connection_timeout' => env('TYPESENSE_TIMEOUT', 2),
            ],
        ],
    ],
```

### Advanced Fields

[](#advanced-fields)

When you create an index, we will use the `auto` schema by default. This uses a wildcard field with the name `.*` to let Typesense automatically detect the type of the fields. We also have to specify that the ID is a string for each schema so we can use our Statamic UUIDs.

```
{
  "name": "articles",
  "fields": [
    {"name": ".*", "type": "auto" },
    {"name":  "id", "type":  "string" }
  ]
}
```

You can find these default settings in the `config/typesense.php` file, and you can add any other default fields (as long as this field exists in every collection!)

If you want to add more advanced options such as facets or sort order, then you can also define these in the `config/typesense.php` file. You can read more about this in the Typesense documentation.

```
    'schema' => [
        'articles' => [
            'fields' => [
                ['name' => 'synopsis', 'optional' => true],
                ['name' => 'category', 'facet' => true],
                ['name' => 'rating', 'type' => 'int32'],
                ['name' => 'published', 'type' => 'bool'],

            ],
            'default_sorting_field' => 'date',
        ],
    ],
```

These options will be merged with the default schema when the index is created on Typesense:

```
{
  "name": "articles",
  "fields": [
    {"name": ".*", "type": "auto" },
    {"name":  "id", "type":  "string" },
    {"name": "synopsis", "optional": "true"},
    {"name": "category", "facet": "true"},
    {"name": "rating", "type": "int32"},
    {"name": "published", "type":  "bool"},
  ],
  "default_sorting_field": "rating"
}
```

Only the fields you have defined in the `indexes` in the `config/static/search.php` file will be saved to Typesense... so you don't need to worry about including `index: false` in the Schema definitions. If you don't want the field to be included in the search index then don't include it in the `indexes` array.

### Quirks

[](#quirks)

1. Typesense requires the schema to be defined before inserting data, if you update the blueprint and fields in Statamic -- you'll need to delete the collection on Typesense and create it again with the new schema.
2. Typesense returns all fields data, so if your `content` field is large it can make the search results payload quite large (this should be fixed in the next release).
3. Typesense with multiple-nodes hasn't been tested yet.

### Multisearch Quirks

[](#multisearch-quirks)

Multi-search works a bit differently in typesense and it'll return a nested list of results for each index... so you lose a lot of relevancy as you may just get a list of *bad* results from the first index because it was at the top of the list, while the *good* results are not shown because the index was last in the list.

To get around this I recommend keeping a `default` search index that works on the `local` driver, and [connect indexes](https://statamic.dev/search#connecting-indexes) to specific collections using Typesense.

```
    'default' => [
        'driver' => 'local',
        'searchables' => 'all',
        'fields' => ['title'],
    ],
```

Then with [connect indexes](https://statamic.dev/search#connecting-indexes) you can use Typesense when you're browsing a specific collection or on the front-end you can use a javascript client to query the results in Typesense.

### Front-end examples

[](#front-end-examples)

1. [Single-index search](https://gist.github.com/tao/b827a4c3a4c0fad06fa52eee4208f0cc)
2. [Multi-index search](https://gist.github.com/tao/a40862ecc19043e977a6dbb93f13badb)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1796d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/883ee9a83f841aecdf6b30eee65aa63f067d68e2e4b8d634a8accc06e84301f8?d=identicon)[k4runa](/maintainers/k4runa)

---

Top Contributors

[![tao](https://avatars.githubusercontent.com/u/1446331?v=4)](https://github.com/tao "tao (10 commits)")

### Embed Badge

![Health badge](/badges/elvenstar-statamic-typesense/health.svg)

```
[![Health](https://phpackages.com/badges/elvenstar-statamic-typesense/health.svg)](https://phpackages.com/packages/elvenstar-statamic-typesense)
```

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[typesense/laravel-scout-typesense-driver

Laravel Scout Driver for Typesense

144637.2k3](/packages/typesense-laravel-scout-typesense-driver)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[handcraftedinthealps/zendsearch

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
