Algolia Search & Discovery extension for Magento 2 (Algolia_AlgoliaSearch). Indexes Magento entities (products, categories, pages, suggestions, additional sections) into Algolia, manages sorting replicas, captures analytics events (clicks, conversions) and personalization signals, and provides frontend search via autocomplete, InstantSearch, faceted navigation, and Recommend widgets. Includes built-in merchandising (landing pages) — likely to be deprecated or reworked. Uses the Algolia PHP API Client v4.
Requirements: PHP 8.2-8.4, Magento 2.4.6+, algolia/algoliasearch-client-php ^4.0
php -l <file>— Syntax-check modified PHP filescomposer validate— Verifycomposer.jsoncorrectnessmagento2-lint <path>— PHP-CS-Fixer (requirescomposer global require algolia/magento2-tools)magento2-analyse <path>— PHPStan level 1 (same global install)magento2-test <path>— Run all quality checks in dry-run mode
This repo is a Magento 2 extension — unit/integration tests require a full Magento environment (Docker or otherwise) and cannot be run from this checkout alone. When tests are unavailable:
- Follow existing patterns in the same directory for new/modified classes
- Verify DI wiring in
etc/di.xmlwhen adding new classes or interfaces - Ensure PSR-4 namespace alignment (
Algolia\AlgoliaSearch\<path>) - Confirm
etc/db_schema.xmlconsistency for schema changes - Run
php -lon all modified PHP files
These commands are for developers with a running Magento instance. CI runs them automatically on (feat|fix|chore)/MAGE* branches.
Unit tests:
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist \
vendor/algolia/algoliasearch-magento-2/Test/UnitIntegration tests (requires ALGOLIA_APPLICATION_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_API_KEY, INDEX_PREFIX env vars):
cd <magento_root>/dev/tests/integration
../../../vendor/bin/phpunit ../../../vendor/algolia/algoliasearch-magento-2/Test/Integration/Read these sections in doc/ARCHITECTURE.md before writing or modifying any code:
- Architectural Invariants — hard rules that must not be violated
- For Contributors — required patterns for new entities, config, and queue handlers
- Key Decisions — design rationale that must be preserved
These apply equally to human contributors and agents. Non-compliance blocks merge.
See doc/ARCHITECTURE.md for the full architectural overview: topology, data flows, indexing pipeline, queue system, key decisions, invariants, and contributor guidelines.
Namespace: PSR-4 root Algolia\AlgoliaSearch (registered in registration.php). Module name: Algolia_AlgoliaSearch.
CircleCI runs on branches matching ^(feat|fix|chore)/MAGE.*. Tests against PHP 8.2 with Magento 2.4.6-p11 and 2.4.7-p6.
- PSR-2 base with additional rules in
.php-cs-fixer.php - Comments should be rare and only when logic isn't self-descriptive — prefer renaming classes/methods over adding comments
- Do not add PHPDoc blocks that merely restate PHP type declarations. Only add PHPDoc when it provides information beyond what the type signature already conveys (e.g.,
@throws, descriptions of non-obvious behavior, or types that cannot be expressed natively such asarray<string, int>). Theno_superfluous_phpdoc_tagsfixer rule enforces this automatically. - PHPStan level 1 compliance required
- MEQP2 marketplace standard — ERRORs block merge, WARNINGs should be avoided