PHPackages                             miroshnichenko-yaroslav/laravel-algolia - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. miroshnichenko-yaroslav/laravel-algolia

ActiveLibrary[API Development](/categories/api)

miroshnichenko-yaroslav/laravel-algolia
=======================================

An Algolia bridge for Laravel

2.5.0(9y ago)09MITPHPPHP ^7.0

Since Mar 14Pushed 8y agoCompare

[ Source](https://github.com/miroshnichenkoYaroslav/laravel-algolia)[ Packagist](https://packagist.org/packages/miroshnichenko-yaroslav/laravel-algolia)[ RSS](/packages/miroshnichenko-yaroslav-laravel-algolia/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (7)Versions (10)Used By (0)

Laravel Algolia
===============

[](#laravel-algolia)

[![laravel-algolia](https://cloud.githubusercontent.com/assets/499192/7440612/f4c34b2e-f0bf-11e4-8cc1-b845256be3ff.png)](https://cloud.githubusercontent.com/assets/499192/7440612/f4c34b2e-f0bf-11e4-8cc1-b845256be3ff.png)

> An [Algolia](https://www.algolia.com/) bridge for Laravel.

```
// Search.
$algolia->search('marty mcfly');

// Create global API keys.
$algolia->addUserKey(['search'], 300);

// Want to use the facade?
Algolia::getLogs();
```

[![Build Status](https://camo.githubusercontent.com/f5307ecdd5994533efd4980c0ff2acebc0e1adc3ecf3fe2ab27739537f41c588/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f76696e6b6c612f6c61726176656c2d616c676f6c69612f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/vinkla/laravel-algolia)[![StyleCI](https://camo.githubusercontent.com/2df17f77c7c798056c97fc10a4c2c05f3b0dfb049b932df05c3a86015a85abc9/68747470733a2f2f7374796c6563692e696f2f7265706f732f33323232373735392f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/32227759)[![Coverage Status](https://camo.githubusercontent.com/f27fe996d4b9cd85b7b3a355bc1875a383217a108d4096d151503da990901fec/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f76696e6b6c612f6c61726176656c2d616c676f6c69612e7376673f7374796c653d666c6174)](https://codecov.io/github/vinkla/laravel-algolia)[![Latest Version](https://camo.githubusercontent.com/20bc4c48fac9dea381b2d08027f8367727b71d929af12a3c15ea77291e988c94/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f76696e6b6c612f616c676f6c69612e7376673f7374796c653d666c6174)](https://github.com/vinkla/algolia/releases)[![License](https://camo.githubusercontent.com/cbd2409ad3a2926a616e851c5cabb934e0f7e93ee5dcb4768e0c3b4ce1631239/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f76696e6b6c612f616c676f6c69612e7376673f7374796c653d666c6174)](https://packagist.org/packages/vinkla/algolia)

Installation
------------

[](#installation)

Require this package, with [Composer](https://getcomposer.org/), in the root directory of your project.

```
$ composer require vinkla/algolia
```

Add the service provider to `config/app.php` in the `providers` array.

```
Vinkla\Algolia\AlgoliaServiceProvider::class
```

If you want you can use the [facade](http://laravel.com/docs/facades). Add the reference in `config/app.php` to your aliases array.

```
'Algolia' => Vinkla\Algolia\Facades\Algolia::class
```

Configuration
-------------

[](#configuration)

Laravel Algolia requires connection configuration. To get started, you'll need to publish all vendor assets:

```
$ php artisan vendor:publish
```

This will create a `config/algolia.php` file in your app that you can modify to set your configuration. Also, make sure you check for changes to the original config file in this package between releases.

#### Default Connection Name

[](#default-connection-name)

This option `default` is where you may specify which of the connections below you wish to use as your default connection for all work. Of course, you may use many connections at once using the manager class. The default value for this setting is `main`.

#### Algolia Connections

[](#algolia-connections)

This option `connections` is where each of the connections are setup for your application. Example configuration has been included, but you may add as many connections as you would like.

Usage
-----

[](#usage)

#### AlgoliaManager

[](#algoliamanager)

This is the class of most interest. It is bound to the ioc container as `algolia` and can be accessed using the `Facades\Algolia` facade. This class implements the ManagerInterface by extending AbstractManager. The interface and abstract class are both part of [Graham Campbell's](https://github.com/GrahamCampbell) [Laravel Manager](https://github.com/GrahamCampbell/Laravel-Manager) package, so you may want to go and checkout the docs for how to use the manager class over at that repository. Note that the connection class returned will always be an instance of `AlgoliaSearch\Client`.

#### Facades\\Algolia

[](#facadesalgolia)

This facade will dynamically pass static method calls to the `algolia` object in the ioc container which by default is the `AlgoliaManager` class.

#### AlgoliaServiceProvider

[](#algoliaserviceprovider)

This class contains no public methods of interest. This class should be added to the providers array in `config/app.php`. This class will setup ioc bindings.

### Examples

[](#examples)

Here you can see an example of just how simple this package is to use. Out of the box, the default adapter is `main`. After you enter your authentication details in the config file, it will just work:

```
// You can alias this in config/app.php.
use Vinkla\Algolia\Facades\Algolia;

Algolia::initIndex('contacts');
// We're done here - how easy was that, it just works!

Algolia::getLogs();
// This example is simple and there are far more methods available.
```

The Algolia manager will behave like it is a `AlgoliaSearch\Client`. If you want to call specific connections, you can do that with the connection method:

```
use Vinkla\Algolia\Facades\Algolia;

// Writing this…
Algolia::connection('main')->initIndex('contacts');

// …is identical to writing this
Algolia::initIndex('contacts');

// and is also identical to writing this.
Algolia::connection()->initIndex('contacts');

// This is because the main connection is configured to be the default.
Algolia::getDefaultConnection(); // This will return main.

// We can change the default connection.
Algolia::setDefaultConnection('alternative'); // The default is now alternative.
```

If you prefer to use dependency injection over facades like me, then you can inject the manager:

```
use Vinkla\Algolia\AlgoliaManager;

class Foo
{
	protected $algolia;

	public function __construct(AlgoliaManager $algolia)
	{
		$this->algolia = $algolia;
	}

	public function bar()
	{
		$this->algolia->initIndex('friends');
	}
}

App::make('Foo')->bar();
```

Documentation
-------------

[](#documentation)

There are other classes in this package that are not documented here. This is because the package is a Laravel wrapper of [the official Algolia Search API package](https://github.com/algolia/algoliasearch-client-php).

License
-------

[](#license)

[MIT](LICENSE) © [Vincent Klaiber](https://vinkla.com)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 95.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~82 days

Recently: every ~103 days

Total

9

Last Release

3419d ago

Major Versions

1.1.0 → 2.0.02015-06-30

PHP version history (5 changes)1.0.0PHP &gt;=5.4.7

1.1.0PHP &gt;=5.5.9

2.2.1PHP ^5.5.9 || ^7.0

2.4.0PHP ^5.6.4 || ^7.0

2.5.0PHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/33ef41d9c8d0acb525192f7186d0477075d95792c8ca7a260ab8f404190fdd5d?d=identicon)[miroshnichenkoYaroslav](/maintainers/miroshnichenkoYaroslav)

---

Top Contributors

[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (108 commits)")[![miroshnichenkoYaroslav](https://avatars.githubusercontent.com/u/28478697?v=4)](https://github.com/miroshnichenkoYaroslav "miroshnichenkoYaroslav (3 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (2 commits)")

---

Tags

apisearchlaravelalgolia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/miroshnichenko-yaroslav-laravel-algolia/health.svg)

```
[![Health](https://phpackages.com/badges/miroshnichenko-yaroslav-laravel-algolia/health.svg)](https://phpackages.com/packages/miroshnichenko-yaroslav-laravel-algolia)
```

###  Alternatives

[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k49.4M479](/packages/laravel-scout)[andreaselia/laravel-api-to-postman

Generate a Postman collection automatically from your Laravel API

1.0k586.2k3](/packages/andreaselia-laravel-api-to-postman)[aerni/laravel-spotify

A Laravel wrapper for the Spotify Web API

209145.6k](/packages/aerni-laravel-spotify)[dragon-code/laravel-json-response

Automatically always return a response in JSON format

1118.6k1](/packages/dragon-code-laravel-json-response)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
