PHPackages                             trendyminds/algolia - 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. trendyminds/algolia

ActiveCraft-plugin[Search &amp; Filtering](/categories/search)

trendyminds/algolia
===================

Easily pull search results from Algolia into your Craft CMS website

5.0.1(1y ago)1332.2k[2 PRs](https://github.com/trendyminds/algolia/pulls)MITPHPPHP ^8.2

Since Nov 14Pushed 1y ago3 watchersCompare

[ Source](https://github.com/trendyminds/algolia)[ Packagist](https://packagist.org/packages/trendyminds/algolia)[ RSS](/packages/trendyminds-algolia/feed)WikiDiscussions craft-4 Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (14)Used By (0)

[![Algolia logo](src/icon.svg)](src/icon.svg) Algolia
=====================================================

[](#-algolia)

[![Query your Algolia data using Twig](resources/promo-banner.png)](resources/promo-banner.png)

About
-----

[](#about)

Algolia for Craft CMS allows you to easily pull search results from Algolia into your Twig templates or through REST API endpoints.

Template Usage
--------------

[](#template-usage)

### Browse an index

[](#browse-an-index)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in the `params` object.

```
{% for result in craft.algolia.browse({
    index: "indexName",
    query: "optional query",
    params: {
      distinct: true,
      getRankingInfo: true
    }
  })
%}

{% endfor %}
```

### Search an index

[](#search-an-index)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in the `params` object.

```
{% set search = craft.algolia.search({
    index: "indexName",
    query: "optional query",
    params: {
      hitsPerPage: 5,
      page: 7
    }
  })
%}

{% for hit in search.hits %}

{% endfor %}
```

### Perform a multiple query search

[](#perform-a-multiple-query-search)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in each `queries` object.

```
{% set search = craft.algolia.multipleQueries([
    {
      indexName: "indexName1",
      query: "optional query"
    },
    {
      indexName: "indexName2",
      query: "optional query"
    }
  ])
%}

{% for group in search.results %}
  {% for hit in group.hits %}

  {% endfor %}
{% endfor %}
```

### Parsing filters

[](#parsing-filters)

When using filters in an Algolia search the engine requires [a particular syntax](https://www.algolia.com/doc/api-reference/api-parameters/filters/). Rather than stringifying your filters in Twig this plugin offers a way to convert an object like...

```
{
  "food": ["fries", "cake", "pizza"],
  "colors": ["blue", "green", "red"],
  "featured": true
}
```

to a valid Algolia filter string like...

```
'(food:"fries" OR food:"cake" OR food:"pizza") AND (colors:"blue" OR colors:"green" OR colors:"red") AND (featured:"1")'

```

```
{% set filters = {
  food: ['fries', 'cake', 'pizza'],
  colors: ['blue', 'green', 'red'],
  featured: true
} %}

{{ craft.algolia.parseFilters(filters) }}
```

Using JSON REST API controllers
-------------------------------

[](#using-json-rest-api-controllers)

In additional to Twig variables you can make a `POST` request to one of the following controller endpoints. The same index, query and optional attributes are available when you make your `POST` request.

**NOTE**: The following examples use [Axios](https://github.com/axios/axios) for making API requests

### Browse an index

[](#browse-an-index-1)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in the `params` object.

```
axios.post("/actions/algolia/default/browse", {
  index: "indexName",
  query: "optional query",
  params: {
    distinct: true,
    getRankingInfo: true
  }
}, {
  headers: {
    "X-CSRF-Token": YOUR_CRAFT_CSRF_TOKEN
  }
});
```

### Search an index

[](#search-an-index-1)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in the `params` object.

```
axios.post("/actions/algolia/default/search", {
  index: "indexName",
  query: "optional query",
  params: {
    hitsPerPage: 5,
    page: 7
  }
}, {
  headers: {
    "X-CSRF-Token": YOUR_CRAFT_CSRF_TOKEN
  }
});
```

### Perform a multiple query search

[](#perform-a-multiple-query-search-1)

[Additional search parameters](https://www.algolia.com/doc/api-reference/search-api-parameters/) can be provided in each `queries` object.

```
axios.post("/actions/algolia/default/multiple-queries", {
  queries: [
    {
      indexName: "indexName1",
      query: "optional query"
    },
    {
      indexName: "indexName2",
      query: "optional query"
    }
  ]
}, {
  headers: {
    "X-CSRF-Token": YOUR_CRAFT_CSRF_TOKEN
  }
});
```

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

[](#requirements)

This plugin requires Craft CMS 3.1.19+ and PHP 7.1+.

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

[](#installation)

[Install Algolia from the Craft CMS Plugin Store!](https://plugins.craftcms.com/algolia)

Attribution
-----------

[](#attribution)

This plugin is powered by the [Algolia PHP API client](https://www.algolia.com/doc/api-client/getting-started/install/php/). The client and icon/logo belong to Algolia.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance49

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

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

Recently: every ~296 days

Total

8

Last Release

370d ago

Major Versions

2.0.0 → 3.0.02021-06-29

3.1.0 → 4.0.02022-07-05

4.0.0 → 5.0.02024-04-05

4.0.1 → 5.0.12025-05-12

PHP version history (4 changes)3.0.0PHP &gt;=7.1

3.1.0PHP &gt;=7.3

4.0.0PHP ^8.0.2

5.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/51ee860b8a11c81c32b2d0bf9f90e23067fcf3cf72476bfab89913bf0e1ea3b3?d=identicon)[trendyminds](/maintainers/trendyminds)

---

Top Contributors

[![aaronbushnell](https://avatars.githubusercontent.com/u/315202?v=4)](https://github.com/aaronbushnell "aaronbushnell (26 commits)")

---

Tags

algoliacmsCraftcraftcmscraft-plugin

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/trendyminds-algolia/health.svg)

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

###  Alternatives

[studioespresso/craft-scout

Craft Scout provides a simple solution for adding full-text search to your entries. Scout will automatically keep your search indexes in sync with your entries.

80136.8k](/packages/studioespresso-craft-scout)[la-haute-societe/craft-elasticsearch

Bring the power of Elasticsearch to your Craft CMS projects.

1712.4k](/packages/la-haute-societe-craft-elasticsearch)[swixpop/locate

Harness the power of the Google Autocomplete API inside Craft. Adds an autocomplete search box to Craft entries.

154.8k](/packages/swixpop-locate)[swishdigital/faceted-navigation

Provides faceted navigation of entries, using categories, which allows site users to narrow the list of entries they see by applying multiple filters (think Amazon or eBay left sidebar).

152.4k](/packages/swishdigital-faceted-navigation)[fork/craft-elastica

A plugin to connect to Elasticsearch and persist elements via hooks

101.8k](/packages/fork-craft-elastica)

PHPackages © 2026

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