PHPackages                             fahlgrendigital/packages-statamic-algolia-support - 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. [API Development](/categories/api)
4. /
5. fahlgrendigital/packages-statamic-algolia-support

ActiveLibrary[API Development](/categories/api)

fahlgrendigital/packages-statamic-algolia-support
=================================================

Support for the Algolia driver in Statamic applications.

v1.0.6(1mo ago)0224MITPHPPHP ^8.3

Since Jan 30Pushed 1mo ago4 watchersCompare

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

READMEChangelogDependencies (14)Versions (22)Used By (0)

Statamic Algolia Support
========================

[](#statamic-algolia-support)

Add helpful support classes for working with the Algolia driver in Statamic applications.

**Compatibility:** Statamic 5.x and 6.x | Laravel 11.x and 12.x | PHP 8.3+

Installation
============

[](#installation)

```
$ composer require fahlgrendigital/packages-statamic-algolia-support
```

### Publish config

[](#publish-config)

```
$ php artisan vendor:publish --tag=statamic-algolia-support-config
```

Usage
=====

[](#usage)

This package focuses on three areas of support for the Algolia driver in Statamic applications:

- [Transformers](#transformers)
- [Index building](#indexes)
- [Index importing (API)](#index-api)

---

Transformers
------------

[](#transformers)

Transformers are Statamic [search transformers](https://statamic.dev/search#transforming-fields) that convert complex Statamic field types into Algolia-compatible formats. Register them in your `config/statamic/search.php` under a field's `transformer` key.

### CollectionTransformer

[](#collectiontransformer)

Extracts the `handle` string from a collection object. Useful for configuring Algolia facets that filter by collection.

```
use Fahlgrendigital\PackagesStatamicAlgoliaSupport\Search\Transformers\CollectionTransformer;

// In config/statamic/search.php
'fields' => [
    'collection' => ['transformer' => CollectionTransformer::class],
],
```

**Returns:** `string|null` — the collection handle, or `null` if empty.

---

### DateTransformer

[](#datetransformer)

Converts a Carbon date object into a formatted date string (`Y-m-d H:i:s`). Compatible with Carbon 2.x and 3.x (Statamic 6).

```
use Fahlgrendigital\PackagesStatamicAlgoliaSupport\Search\Transformers\DateTransformer;

'fields' => [
    'date' => ['transformer' => DateTransformer::class],
],
```

**Returns:** `string|null` — formatted date string, or passes through non-Carbon values unchanged.

> **Statamic 6 note:** Statamic 6 requires Carbon 3. Dates now convert to UTC at runtime. If your app uses a non-UTC timezone, configure `'localize_dates_in_modifiers' => true` in `config/statamic/system.php`.

---

### MarkupTransformer

[](#markuptransformer)

Strips HTML from Bard and Textarea fields, returning plain searchable text. For Bard fields, it uses Statamic's `bardText` modifier to properly handle the ProseMirror document structure.

```
use Fahlgrendigital\PackagesStatamicAlgoliaSupport\Search\Transformers\MarkupTransformer;

'fields' => [
    'content' => ['transformer' => MarkupTransformer::class], // Bard or Textarea
],
```

**Returns:** `string|null` — plain text content, or `null` if empty.

---

### TaxonomyTransformer

[](#taxonomytransformer)

Resolves taxonomy term references (slugs stored on an entry) into structured arrays containing `id`, `slug`, and `title`. Results are cached for 1 hour per term to avoid repeated lookups during large index builds.

Works with both flat-file entries and Eloquent entries.

```
use Fahlgrendigital\PackagesStatamicAlgoliaSupport\Search\Transformers\TaxonomyTransformer;

'fields' => [
    'tags' => ['transformer' => TaxonomyTransformer::class],
],
```

**Returns:** `array|null` — `['tags' => [['id' => ..., 'slug' => ..., 'title' => ...], ...]]`, or `null` for non-entry searchables, or `[]` for entries with no terms.

---

### RecordUrlTransformer

[](#recordurltransformer)

Generates the URL for an Entry or Asset searchable. Returns `null` for other searchable types (e.g. taxonomy terms).

```
use Fahlgrendigital\PackagesStatamicAlgoliaSupport\Search\Transformers\RecordUrlTransformer;

'fields' => [
    'url' => ['transformer' => RecordUrlTransformer::class],
],
```

**Returns:** `string|null` — the URL for entries and assets, `null` otherwise.

---

Indexes
-------

[](#indexes)

The index builder exports Statamic search indexes to JSON or CSV files on a configured filesystem disk. This is useful for:

- Bulk-replacing an Algolia index without hitting record-level API limits
- Keeping index snapshots across environments
- Feeding downstream services via the [Index API](#index-api)

### Filesystem disk configuration

[](#filesystem-disk-configuration)

Define a disk in `config/filesystems.php`:

```
'algolia-indexes' => [
    'driver' => 'local',
    'root'   => storage_path('app/algolia-indexes'),
],
```

Then set `ALGOLIA_SUPPORT_DISK=algolia-indexes` in your `.env` (or publish and edit `config/algolia-support.php`).

### Commands

[](#commands)

**Build a single index export:**

```
php artisan algolia:search-index:build-file {index} -T json/csv [-D] [--json-stats]
```

OptionDescription`{index}`The Statamic search index key (must exist in `config/statamic/search.php`)`-T, --file-type`Export format: `json` or `csv``-D, --dry-run`Run without writing any files`--json-stats`Print min/max/avg record sizes after building (JSON only)Files are named `search-index-{index}-{timestamp}.{ext}`. Only the 3 most recent files per index are kept; older files are deleted automatically.

**Build computed (combined) indexes:**

```
php artisan algolia:build-computed-indexes
```

Merges records from multiple Algolia indexes (fetched via the Algolia API) into a single JSON file. Configure sources in `config/algolia-support.php`:

```
'computed_indexes' => [
    'combined_products' => [
        'sources' => ['products_en', 'products_es'],
    ],
],
```

> **Note:** `AlgoliaBuildComputedIndexes` uses the Algolia PHP client v3 API. Upgrading to client v4 will require rewriting this command for the new API surface.

---

Index API
---------

[](#index-api)

The package registers a read-only API endpoint that serves the most recently built index file:

```
GET /api/algolia/indexes/{index}

```

Returns the latest `search-index-{index}-*.json` file from the configured disk as a binary file response. Returns 404 if the index doesn't exist or no file has been built yet.

The URI path is configurable via `ALGOLIA_SUPPORT_API_URI` (default: `/algolia/indexes`).

---

Configuration reference
-----------------------

[](#configuration-reference)

```
// config/algolia-support.php
return [
    // Filesystem disk name where index exports are stored
    'disk'             => env('ALGOLIA_SUPPORT_DISK', 'algolia-indexes'),

    // URI prefix for the index retrieval API
    'api_uri'          => env('ALGOLIA_SUPPORT_API_URI', '/algolia/indexes'),

    // PHP memory limit for the index builder command
    'memory_limit'     => '2028M',

    // Computed indexes: each key is the output index name,
    // 'sources' lists Algolia index names to merge from
    'computed_indexes' => [],
];
```

---

Statamic 5 → 6 upgrade notes
----------------------------

[](#statamic-5--6-upgrade-notes)

AreaImpactAction`statamic/cms` constraint—Package now supports `^5.0|^6.0`. Run `composer update`.Carbon 3Low`DateTransformer` uses `->format()` which is compatible with Carbon 3. Review UTC timezone behavior (see note above).Search `searchables: all` removedMediumRemoved in Statamic 6. Replace with `'content'` or an explicit list in your `config/statamic/search.php`.Algolia PHP client v3Pending`AlgoliaBuildComputedIndexes` uses v3-specific APIs. Monitor whether Statamic 6 or its Algolia driver requires client v4 and update accordingly.Entry status queriesNoneThis package does not use `->where('status', ...)`. No action needed.Vue 3 / Control PanelNoneThis package has no Control Panel components.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~22 days

Recently: every ~36 days

Total

20

Last Release

39d ago

Major Versions

v0.0.13 → v1.0.02025-06-05

v1.0.4 → 6.x-dev2026-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/60dfacae6ab4f80fadfea286b16ad311302ccef2c53d687b25248d242c4b0541?d=identicon)[fahlgren](/maintainers/fahlgren)

---

Top Contributors

[![panda4man](https://avatars.githubusercontent.com/u/3106756?v=4)](https://github.com/panda4man "panda4man (21 commits)")[![lasota](https://avatars.githubusercontent.com/u/5107146?v=4)](https://github.com/lasota "lasota (2 commits)")

---

Tags

laravelcmsstatamicflat file

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/fahlgrendigital-packages-statamic-algolia-support/health.svg)

```
[![Health](https://phpackages.com/badges/fahlgrendigital-packages-statamic-algolia-support/health.svg)](https://phpackages.com/packages/fahlgrendigital-packages-statamic-algolia-support)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.2M720](/packages/statamic-cms)[statamic/statamic

Statamic

824170.4k](/packages/statamic-statamic)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6272.7k4](/packages/riclep-laravel-storyblok)[cboxdk/statamic-mcp

MCP (Model Context Protocol) server for Statamic CMS v6 — gives AI assistants structured access to content, blueprints, assets, and more.

225.6k](/packages/cboxdk-statamic-mcp)[joy/voyager-api

This Laravel/Voyager module adds REST Api with swagger support to Voyager.

204.7k3](/packages/joy-voyager-api)

PHPackages © 2026

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