PHPackages                             daun/statamic-loupe - 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. [Database &amp; ORM](/categories/database)
4. /
5. daun/statamic-loupe

ActiveStatamic-addon[Database &amp; ORM](/categories/database)

daun/statamic-loupe
===================

Loupe search driver for Statamic

3.1.0(1mo ago)35.7k↓44%MITPHPPHP ^8.3CI passing

Since Nov 20Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/daun/statamic-loupe)[ Packagist](https://packagist.org/packages/daun/statamic-loupe)[ RSS](/packages/daun-statamic-loupe/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (19)Versions (20)Used By (0)

Statamic Loupe Search Driver
============================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/5a6e56c643b8178a525d6701ef5e0f7bf9cb78b2922e0a7e20a2ce54db39bb3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6461756e2f73746174616d69632d6c6f7570652e737667)](https://packagist.org/packages/daun/statamic-loupe) [![Test Status](https://camo.githubusercontent.com/4c3b38fb1d3ca0f25a2800e12c5749f036b181c3c3c8590506ee70459e436157/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6461756e2f73746174616d69632d6c6f7570652f63692e796d6c3f6c6162656c3d7465737473)](https://github.com/daun/statamic-loupe/actions/workflows/ci.yml) [![License](https://camo.githubusercontent.com/5441256b2050655a70802cecd3c7e7f407e5a0d133e50b6e55437d87271ad050/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461756e2f73746174616d69632d6c6f7570652e737667)](https://github.com/daun/statamic-loupe/blob/master/LICENSE)

**This addon provides a [Loupe](https://github.com/loupe-php/loupe) search driver for Statamic sites.**

Loupe
-----

[](#loupe)

...is a local SQLite search engine that is easy to set up and requires no additional infrastructure.

- Only requires PHP and SQLite, nothing else
- Tolerates typos and supports stemming
- Supports `-negated` queries and `"phrase search"`
- Supports filtering and ordering on geo distance
- Sorts by relevance

This addon
----------

[](#this-addon)

- Manages search indexes behind the scenes
- Provides highlights and snippets for contextual search results

Requirements
------------

[](#requirements)

- SQLite PDO 3.35 or higher

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

[](#installation)

```
composer require daun/statamic-loupe
```

Add the new driver to `statamic/search.php`.

```
'drivers' => [
    'local' => ['path' => storage_path('statamic/search')],
+   'loupe' => [],
],
```

Now set your indexes to use the new driver.

```
'indexes' => [
    'default' => [
-       'driver' => 'local',
+       'driver' => 'loupe',
        'searchables' => 'content',
    ],
],
```

Configuration
-------------

[](#configuration)

While Loupe will work just fine with the default settings, there are a few knobs you can turn to fine-tune the indexing and ranking of results. The values below are the default values. Most of these map directly to [Loupe's configuration items](https://github.com/loupe-php/loupe/blob/main/docs/configuration.md).

```
'drivers' => [
    'loupe' => [
        // Storage directory of Loupe's index database
        'path' => storage_path('statamic/loupe'),

        // Maximum number of words allowed in a search
        // Higher values allow more complex queries but may impact performance
        'max_query_tokens' => 10,

        // Minimum word length to allow searching by prefix
        'min_token_length_for_prefix_search' => 2,

        // Languages to consider for detecting stemming language
        // Not required for stemming, but speeds things up if they are known
        'stemming_languages' => [],

        // Whether typo tolerance is enabled
        'typo_tolerance_enabled' => true,

        // Size of the alphabet used for typo tolerance
        'typo_tolerance_alphabet_size' => 4,

        // Maximum length of terms to index for typo tolerance
        'typo_tolerance_index_length' => 14,

        // Whether typo tolerance is enabled in prefix search
        'typo_tolerance_for_prefix_search' => false,

        // Minimum ranking score of results to return (between `0.0` and `1.0`)
        'ranking_score_threshold' => 0,
    ],
],
```

Search highlights
-----------------

[](#search-highlights)

Enable term highlighting to wrap occurrences of search words in `` tags. You'll need to explicitly define the attributes to apply highlighting in.

```
'indexes' => [
    'default' => [
        'driver' => 'loupe',
        'searchables' => 'content',
+       'highlight_attributes' => ['title', 'summary'],
    ],
],
```

You can now display the configured fields from the `search_highlights` namespace:

```
{{ search:results }}
  {{ search_highlights:title }}
  {{ search_highlights:summary }}
{{ /search:results }}
```

You can also configure the exact tags to use for highlighting terms:

```
'indexes' => [
    'default' => [
        'driver' => 'loupe',
        'searchables' => 'content',
        'highlight_attributes' => ['title', 'summary'],
+       'highlight_tags' => ['', ''],
    ],
],
```

Search snippets
---------------

[](#search-snippets)

Snippets are condensed highlights collecting only the actual matches and the text immediately surrounding them. This allows quick skimming of search results for relevancy and context.

> Lorem ipsum dolor sit amet, consetetur ... no sea takimata sanctus est lorem est ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur ... dolore te feugait nulla facilisi lorem ipsum dolor sit amet, consectetuer ...

To enable snippets, define the attributes you want to generate them for, as well as the number of words to include around each match.

```
'indexes' => [
    'default' => [
        'driver' => 'loupe',
        'searchables' => 'content',
+       'snippet_attributes' => ['title' => 5, 'summary' => 10],
    ],
],
```

Then use the `search_snippets` namespace to display the formatted fields:

```
{{ search:results }}
  {{ search_snippets:title }}
  {{ search_snippets:summary }}
{{ /search:results }}
```

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~35 days

Recently: every ~95 days

Total

15

Last Release

55d ago

Major Versions

1.7.0 → 2.0.02025-12-19

2.0.0 → 3.0.02026-02-08

PHP version history (2 changes)1.0.0PHP ^8.1

3.0.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/31ac2b3787ded290b6bac87b937abf4f267483e4da64731bfb256a942bb669ca?d=identicon)[daun](/maintainers/daun)

---

Top Contributors

[![daun](https://avatars.githubusercontent.com/u/22225348?v=4)](https://github.com/daun "daun (144 commits)")

---

Tags

loupesearchsqlitestatamicsearchsqlitedriverstatamicloupe

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/daun-statamic-loupe/health.svg)

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

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[statamic/statamic

Statamic

824170.4k](/packages/statamic-statamic)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[mozex/laravel-scout-bulk-actions

A Laravel Scout extension for bulk importing and flushing of all models.

1033.4k](/packages/mozex-laravel-scout-bulk-actions)[laravel-freelancer-nl/aranguent

Laravel bridge for the ArangoDB Multi-model database

517.0k](/packages/laravel-freelancer-nl-aranguent)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1661.7k](/packages/statamic-rad-pack-meilisearch)

PHPackages © 2026

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