Framework integration
/
Symfony
/
Getting started
Feb 01, 2022
Installation
Require the dependency (with Composer)
Copy
$
composer require algolia/search-bundle
Register the bundle
The bundle is registered automatically. If it does not register, add the following entry to config/bundles.php
if you’re using Symfony 4.x.
Copy
1
2
3
4
5
6
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:
Copy
1
2
3
4
5
$bundles = [
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
// ... Other bundles ...
new Algolia\SearchBundle\AlgoliaSearchBundle(),
];
Algolia credentials
You will also need to provide the Algolia App ID and Admin API key. By default, they
are loaded from the ALGOLIA_APP_ID
and ALGOLIA_API_KEY
environment variables.
If you use .env
config file, you can set them there.
Copy
1
2
ALGOLIA_APP_ID="YourApplicationID"
ALGOLIA_API_KEY="YourAPIKey"
If you don’t use environment variables, you can set your credentials in your parameters.yml
file.
Copy
1
2
3
parameters:
env(ALGOLIA_APP_ID): "YourApplicationID"
env(ALGOLIA_API_KEY): "YourAPIKey"
Did you find this page helpful?