Download the PHP package korcontrol/craft-algolia without Composer

On this page you can find all versions of the php package korcontrol/craft-algolia. 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 craft-algolia

Craft Algolia

A Craft CMS 5 plugin for config-driven Algolia search indexing.

Supports entries and assets via a declarative config file, with a custom indexer escape hatch for complex cases.


Installation

Require the plugin with Composer and install it:


Environment Variables

Add these to your .env file:

The write API key must have addObject, deleteObject, and deleteIndex permissions. Never expose it publicly — it stays server-side only.


Algolia Index Configuration

After creating your index, configure the following settings in the Algolia dashboard under Index → Configuration.

Searchable Attributes

Under Searchable attributes, add:

Attributes for Faceting

Under Facets → Attributes for faceting, add:

Required — the plugin uses deleteBy filters on elementID and siteID when saving and deleting elements. Without these, stale records will not be removed and deletions will silently fail.

Deduplication

Under Deduplication and Grouping:

The plugin splits large body fields across multiple Algolia records (e.g. 42-1-0, 42-1-1). Without deduplication, a single entry could appear multiple times in search results.


Configuration

Copy the plugin's src/config.php to your project's config/ directory as algolia.php:

Credentials are read from environment variables automatically. The config file is where you define which sections and volumes to index.


Config Reference

Entries

Index entries from one or more sections:

Options

Key Type Default Description
bodyFields array [] Field handles whose content is concatenated into the body attribute
bodyMode string 'search' How body content is extracted — 'search' uses Craft's search keywords extractor (recommended for Matrix/CKEditor fields), 'plaintext' casts the field value directly to string
dateField string 'postDate' Which date field to use for filterDate and filterYear — useful for events with a custom event date field
extraFields array [] Map of fieldHandle => algoliaAttribute for additional scalar fields to include

Standard fields always indexed for entries

objectID, elementID, section, sectionHandle, title, url, postDate, filterDate, filterYear, body, siteID, siteHandle


Assets

Index assets from one or more volumes:

Options

Key Type Default Description
extraFields array [] Map of fieldHandle => algoliaAttribute for additional scalar fields to include

Standard fields always indexed for assets

objectID, elementID, section, sectionHandle, title, url, updatedDate, filterDate, filterYear, siteID, siteHandle


The searchable Field

If an entry or asset field layout contains a field with the handle searchable (a Lightswitch field), the plugin uses it as an opt-in gate. The element is only indexed if the field is enabled. If no searchable field exists on the layout, all elements are indexed by default.


Custom Indexers

For complex cases — relational fields, Commerce products, or any logic that can't be expressed in config — register a custom indexer class:

Custom indexers are checked first and take priority over config-driven ones.

Writing a Custom Entry Indexer

Extend BaseEntryIndexer and implement sectionHandle() and getIndexData():

Writing a Custom Asset Indexer

Extend BaseAssetIndexer and implement volumeHandle() and getIndexData():


Reindexing

Since the plugin indexes on save, use Craft's built-in resave commands to index existing content:


How Indexing Works


Running Tests

The plugin includes a test suite using Codeception with a Docker-based Postgres instance.


All versions of craft-algolia with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
craftcms/cms Version ^5.0
algolia/algoliasearch-client-php Version ^4.0
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 korcontrol/craft-algolia contains the following files

Loading the files please wait ...