symphony_small_white Created with Sketch.



This Symfony bundle provides an easy way to integrate Algolia Search into your Symfony2 with Doctrine2 application.


With composer

composer require algolia/algolia-search-bundle

Register the bundle

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

$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:

    database_driver: pdo_mysql
    # ...
    algolia.application_id: YOUR_APP_ID
    algolia.api_key: YOUR_API_KEY

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

    application_id: YOUR_APP_ID
    api_key: YOUR_API_KEY

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

    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)