Skip to main content

Require the dependency (with Composer)

composer require algolia/search-bundle

Register the bundle

The bundle is registered automatically. If it doesn’t register, add the following entry to config/bundles.php if you’re using Symfony 4 and later.
PHP
return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    // ... Other bundles ...
    Algolia\SearchBundle\AlgoliaSearchBundle::class => ['all' => true],
];
If you’re using Symfony 3.4, add Algolia to your app/Kernel.php file:
PHP
$bundles = [
    new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
    // ... Other bundles ...
    new Algolia\SearchBundle\AlgoliaSearchBundle(),
];

Algolia credentials

You need to provide the Algolia App ID and Admin API key. By default, they’re loaded from the ALGOLIA_APP_ID and ALGOLIA_API_KEY environment variables. If you use a .env file, you can set them there.
ALGOLIA_APP_ID="ALGOLIA_APPLICATION_ID"
ALGOLIA_API_KEY="ALGOLIA_API_KEY"
If you don’t use environment variables, you can set your credentials in your parameters.yml file.
YAML
parameters:
  env(ALGOLIA_APP_ID): "ALGOLIA_APPLICATION_ID"
  env(ALGOLIA_API_KEY): "ALGOLIA_API_KEY"
⌘I