Download the PHP package directlease/silverstripe-algolia-page-sync-module without Composer

On this page you can find all versions of the php package directlease/silverstripe-algolia-page-sync-module. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-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

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:

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/

Requirements

Fluent support

Installation

License

See License

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

A sync that only pushes the changes:

For a full sync:

Via Terminal

A sync that only pushes the changes:

For a full sync:

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:

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 & 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->Locale->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:

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

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->Locale->MyImage = URL, and the non-localised will result in MyImage = URL.

Example configurations

Basic config:

A config with Fluent support:

A config without fluent support:


All versions of silverstripe-algolia-page-sync-module with dependencies

PHP Build Version
Package Version
Requires algolia/algoliasearch-client-php Version ^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package directlease/silverstripe-algolia-page-sync-module contains the following files

Loading the files please wait ....