PHPackages                             directlease/silverstripe-algolia-page-sync-module - 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. directlease/silverstripe-algolia-page-sync-module

ActiveSilverstripe-vendormodule[Search &amp; Filtering](/categories/search)

directlease/silverstripe-algolia-page-sync-module
=================================================

A module that based on configuration syncs pages to an Algolia index

0.9.1(3y ago)01.8k↑50%1MITPHP

Since Mar 8Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/DirectLease/SilverStripe-Algolia-page-sync-module)[ Packagist](https://packagist.org/packages/directlease/silverstripe-algolia-page-sync-module)[ RSS](/packages/directlease-silverstripe-algolia-page-sync-module/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (24)Used By (0)

SilverStripe DirectLease Algolia page sync module
=================================================

[](#silverstripe-directlease-algolia-page-sync-module)

This module packs a solution to sync Pages to Algolia via SilverStripe's BuildTask. It keeps track of the SiteTree to sync only the changes. It uses the build in SilverStripe "ShowInSearch" to determine if a Page needs to be synced.

How it works
------------

[](#how-it-works)

Via a Task and some ORM Objects the state of the SiteTree and Algolia can be managed. The PageAlgoliaExtension is hooked on the Page Class to keep track of the deleted pages. There are 3 ORM objects being created to keep track of the state:

- The removed pages in the DeletedPageAlgoliaObjectIDHolder
- The synced pages in the PageAlgoliaObjectIDHolder
- The last date of the sync in AlgoliaSyncLog, this also contains some useful information from the synctask

We now can sync for the three conditions: Added, removed and updated pages. The AlgoliaIndexTask does this. If you want to update your Algolia index with search-results every 12 hours, you can schedule this task for every 12 hours. The tasks provides a `fullsync` param to do a full sync (rather than processing only the changes).

Via Config it is possible to add fields/images urls that will be synced to an Algolia index.

It is possible to add localised data if you use Fluent. Via config it is possible to add fields/image urls that will be added in the Algolia object in a local object. This makes it possible to use the Algolia search with search-attributes. For example, you can add as search attributes: Locales.nl\_NL and this object will contain the data. Algolia is smart enough to include all the variables in this object.

It will log to SilverStripe.log(based on config) and a a record will be created after the task has run succesfully in the database. Read more about silverstripe logging: [https://docs.silverstripe.org/en/4/developer\_guides/debugging/error\_handling/](https://docs.silverstripe.org/en/4/developer_guides/debugging/error_handling/)

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

[](#requirements)

- SilverStripe ^4.0

Fluent support

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

[](#installation)

```
composer require directlease/silverstripe-algolia-page-sync-module

```

License
-------

[](#license)

See [License](LICENSE)

How to run
----------

[](#how-to-run)

If a sync hasn't been run yet, a full sync will happen. You can schedule this task for any given time period to keep your algolia data up to date.

#### Via browser

[](#via-browser)

A sync that only pushes the changes:

```
https://mysite.nl/dev/tasks/AlgoliaSyncModuleDirectLease-AlgoliaIndexTask # A sync that only pushes the changes
```

For a full sync:

```
https://mysite.nl/dev/tasks/AlgoliaSyncModuleDirectLease-AlgoliaIndexTask?fullsync=1 # For a full sync
```

### Via Terminal

[](#via-terminal)

A sync that only pushes the changes:

```
php vendor/silverstripe/framework/cli-script.php /dev/tasks/AlgoliaSyncModuleDirectLease-AlgoliaIndexTask
```

For a full sync:

```
php vendor/silverstripe/framework/cli-script.php /dev/tasks/AlgoliaSyncModuleDirectLease-AlgoliaIndexTask fullsync=1
```

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

[](#configuration)

Via config an extension will be set on the Page Class. This will add an onBeforeDelete action to keep track of the deleted/unpublished pages. Via config it is possible to add fields that will be synced to Algolia. If the field or image exists on the page, it will be added no matter the page type.

The default values that will be added are:

- Title
- MenuTitle
- PageClass
- URL

It is possible to add your own DBFields/functions for localised or non localised fields. It is also possible to add localised or non-localised Images if a DataObject has a $has\_one relation to that image. If you want to return your own data via a method, it is also possible to add this to the fields config (for example: via a method called getMyAwesomeCustomLogic).

##### AlgoliaSyncFieldsLocalised &amp; AlgoliaSyncFieldsNonLocalised

[](#algoliasyncfieldslocalised--algoliasyncfieldsnonlocalised)

An array containing the fields whose values are being synced to Algolia. The difference between the localised and non-localised keys is: if Fluent is installed, it will put the data in a localised object. The localised object in Algolia will be Locales-&gt;Locale-&gt;Key = Value, and the non-localised will result in Key = Value.

It is also possible to provide your own data. If you create your own function returning data you need to use the "get" prefix. For example a function called getMyCustomData() can be accessed if you add to the config:

- "MyCustomData"

The return value of function "getMyCustomData()" if available/not null will be added to the algolia object. In case of a localised object Locales-&gt;Locale-&gt;MyCustomData = Value, and the non-localised will result in MyCustomData = Value.

##### AlgoliaSyncImagesLocalised &amp; AlgoliaSyncImagesNonLocalised

[](#algoliasyncimageslocalised--algoliasyncimagesnonlocalised)

An array containing the names of $has\_one image relations to be synced to Algolia. If the page has an Image relation, and the image is published, the Link() return will be saved in Algolia. The difference between the localised and non-localised keys is: if Fluent is installed, it will put the data in a localised object. The localised object in Algolia will be Locales-&gt;Locale-&gt;MyImage = URL, and the non-localised will result in MyImage = URL.

- 'MyImage'

Example configurations
----------------------

[](#example-configurations)

Basic config:

```
---
name: 'my overide'
After:
  - '#algoliapagesyncmoduleconfig'
---
Page:
  extensions:
    - AlgoliaSyncModuleDirectLease\PageAlgoliaExtension
AlgoliaKeys:
  adminApiKey: '' # Algolia Admin API KEY
  applicationId: '' # Algolia App ID
  indexName: 'sitecontent' # default name of the index the pages will be synced in
AlgoliaSyncFieldsLocalised:
AlgoliaSyncFieldsNonLocalised:
AlgoliaSyncImagesLocalised:
AlgoliaSyncImagesNonLocalised:
```

A config with Fluent support:

```
---
name: 'my overide'
After:
  - '#algoliapagesyncmoduleconfig'
---
Page:
 extensions:
  - AlgoliaSyncModuleDirectLease\PageAlgoliaExtension
AlgoliaKeys:
  adminApiKey: '' # Algolia Admin API KEY
  applicationId: '' # Algolia App ID
  indexName: 'sitecontent' # default name of the index the pages will be synced in
AlgoliaSyncFieldsLocalised:
 - "MyAwesomeSearchTextHolder"
 - "MyAwesomeSearchTextHolder2"
AlgoliaSyncFieldsNonLocalised:
 - "MyAwesomeSearchTextHolderNonLocalised"
AlgoliaSyncImagesLocalised:
 - "MyAwesomeImage"
AlgoliaSyncImagesNonLocalised:
 - "MyAwesomeImageButNonLocalised"
```

A config without fluent support:

```
---
name: 'my overide'
After:
  - '#algoliapagesyncmoduleconfig'
---
Page:
 extensions:
  - AlgoliaSyncModuleDirectLease\PageAlgoliaExtension
AlgoliaKeys:
  adminApiKey: '' # Algolia Admin API KEY
  applicationId: '' # Algolia App ID
  indexName: 'sitecontent' # default name of the index the pages will be synced in
AlgoliaSyncFieldsLocalised:
AlgoliaSyncFieldsNonLocalised:
 - "MyAwesomeSearchTextHolder"
AlgoliaSyncImagesLocalised:
AlgoliaSyncImagesNonLocalised:
 - "MyAwesomeImage"
 - "MyAwesomeImage2"
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance44

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.8% 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 ~44 days

Recently: every ~169 days

Total

19

Last Release

1100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e741bad618c41db089bfe87e1751aef332e6a56b66277e4abb2bca336f099566?d=identicon)[fuzz10](/maintainers/fuzz10)

---

Top Contributors

[![teundirectlease](https://avatars.githubusercontent.com/u/73477370?v=4)](https://github.com/teundirectlease "teundirectlease (33 commits)")[![lars-lemon8](https://avatars.githubusercontent.com/u/15701748?v=4)](https://github.com/lars-lemon8 "lars-lemon8 (3 commits)")[![blueskies79](https://avatars.githubusercontent.com/u/6065560?v=4)](https://github.com/blueskies79 "blueskies79 (2 commits)")

---

Tags

silverstripealgoliacms

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/directlease-silverstripe-algolia-page-sync-module/health.svg)

```
[![Health](https://phpackages.com/badges/directlease-silverstripe-algolia-page-sync-module/health.svg)](https://phpackages.com/packages/directlease-silverstripe-algolia-page-sync-module)
```

###  Alternatives

[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.3M6](/packages/algolia-scout-extended)[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)[trendyminds/algolia

Easily pull search results from Algolia into your Craft CMS website

1332.2k](/packages/trendyminds-algolia)

PHPackages © 2026

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