symphony_small_white Created with Sketch.

Setup

Install

With composer

composer require algolia/algolia-search-bundle

Register the bundle

Add Algolia\AlgoliaSearchBundle\AlgoliaAlgoliaSearchBundle() to your application Kernel:

<?php
$bundles = array(
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
    new Algolia\AlgoliaSearchBundle\AlgoliaAlgoliaSearchBundle(),
);

Fill in your Algolia credentials

Add your Algolia application ID and API key to your parameters.yml file:

parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    # ...
    algolia.application_id: YOUR_APP_ID
    algolia.api_key: YOUR_API_KEY

You can also define those credentials directly in your config.yml file:

algolia:
    application_id: YOUR_APP_ID
    api_key: YOUR_API_KEY

There’s two optional parameters you can add to this file:

algolia:
    catch_log_exceptions: true
    index_name_prefix: staging
    connection_timeout: 2
  • catch_log_exceptions: If set to true, all exceptions thrown in the doctrine event subscriber will be caught and logged.
  • index_name_prefix: If set, this will add a prefix to all the index names (Useful if you want to setup multiple environments within the same Algolia app)
  • connection_timeout: If set, this will set connection timeout to Algolia (in seconds)