Install via composer
algolia/algoliasearch-laravel to your
composer require algolia/algoliasearch-laravel
Add the service provider to
config/app.php in the
Configure API Keys
Laravel Algolia requires a connection configuration. The package comes with a configuration files where you’ll set your Algolia credentials (applicationID and API Key). Add it to your project with the following command:
php artisan vendor:publish --provider="Vinkla\Algolia\AlgoliaServiceProvider"
This will create a
config/algolia.php file in your app that you can modify to set your configuration. You can also create this file manually by copying the file
We recommend to use environment specific variables like in the following example:
<?php return [ 'default' => 'main', 'connections' => [ 'main' => [ 'id' => env('ALGOLIA_APP_ID'), 'key' => env('ALGOLIA_API_KEY'), ], ], ];
And set those value in your
NOTE: make sure you check for changes compared to the original config file after an upgrade. The original file can be found here
Did you find this page helpful?
We're always looking for advice to help improve our documentation!
Please let us know what's working (or what's not!).
We're constantly iterating thanks to the feedback we receive.