PHPackages                             tsterker/solarium - 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. tsterker/solarium

ActiveLibrary[API Development](/categories/api)

tsterker/solarium
=================

Laravel Manager for Solarium

v1.1.1(4y ago)01.5k1MITPHP

Since Jul 21Pushed 4y agoCompare

[ Source](https://github.com/tsterker/Laravel-Solarium)[ Packagist](https://packagist.org/packages/tsterker/solarium)[ RSS](/packages/tsterker-solarium/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (3)Versions (7)Used By (0)

Laravel Solarium
================

[](#laravel-solarium)

A [Solarium](https://github.com/solariumphp/solarium) connection manager for [Laravel](https://laravel.com/). It utilizes the [Laravel Manager](https://github.com/GrahamCampbell/Laravel-DigitalOcean) package by [Graham Campbell](https://github.com/GrahamCampbell).

Installation
============

[](#installation)

```
$ composer require tsterker/solarium
```

Once installed, if you are not using automatic package discovery, then you need to register the `TSterker\Solarium\SolariumServiceProvider` service provider in your config/app.php.

You can also optionally alias our facade:

```
        'Solarium' => TSterker\Solarium\Facades\Solarium::class,
```

Configuration
=============

[](#configuration)

Laravel Solarium requires connection configuration. The default configuration of this package uses the following environment variables and defaults:

```
SOLR_CONNECTION=main  # Publish config/solarium.php to configure multiple connections
SOLR_TIMEOUT=60
SOLR_HOST=localhost
SOLR_PORT=8983
SOLR_PATH=/
```

For more control you should publish the solarium configuration:

```
$ php artisan vendor:publish --provider TSterker\\Solarium\\SolariumServiceProvider
```

This will create a `config/solarium.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.

There are two main config options:

**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'.

**Solarium Connections**

This option (`'connections'`) is where each of the connections are setup for your application. The relevant fields for a connection are `host`, `port`, `path`. Optionally you can provide `timeout` and `core` (or `collection` when using solr cloud). Check the [Solarium documentation](https://solarium.readthedocs.io/en/stable/getting-started/#basic-usage) for details.

Usage
=====

[](#usage)

**SolariumManager**

This is the class of most interest. It is bound to the ioc container as `'solarium'` and can be accessed using the `Facades\Solarium` facade. This class implements the `ManagerInterface` by extending `AbstractManager` from the [Laravel Manager](https://github.com/GrahamCampbell/Laravel-DigitalOcean) package. Note that the connection class returned will always be an instance of [`Solarium\Client`](https://github.com/solariumphp/solarium/blob/master/src/Client.php).

**Facades\\Solarium**

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

Example: Using Facade
---------------------

[](#example-using-facade)

```
use TSterker\Solarium\Facades\Solarium;
// you can alias this in config/app.php if you like

Solarium::getEndpoint()->setCollection($this->collection);
// or configure a default core/collection in the config/solarium.php

$select = Solarium::createSelect();

$docs = Solarium::select($select)->getDocuments();
```

Example: Using Dependency Injection
-----------------------------------

[](#example-using-dependency-injection)

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

```
use TSterker\Solarium\SolariumManager;

class Searcher
{
    protected $solarium;

    protected $collection = 'default-collection';

    public function __construct(SolariumManager $solarium)
    {
        $solarium->getEndpoint()->setCollection($this->collection);
        $this->solarium = $solarium;
    }

    /* @return \Solarium\QueryType\Select\Result\Document[] */
    public function all(): array
    {
        $select = $this->solarium->createSelect();

        return $this->solarium->select($select)->getDocuments();
    }
}

app(Searcher::class)->all();
```

Change Http Adapter
===================

[](#change-http-adapter)

By default the package uses the `Curl` adapter. In order to use a different adapter, just register it in your `AppServiceProvider`.

e.g. to use the [Symphony PSR-18 HTTP Client](https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17), first install the dependencies

```
composer require psr/http-client
composer require nyholm/psr7
composer require symfony/http-client
```

And then register the Solarium `Psr18Adapter`:

```
$this->app->singleton('solarium.adapter', function () {
    $factory = new Psr17Factory();
    return new Psr18Adapter(new Psr18Client(), $factory, $factory);
});
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~148 days

Total

5

Last Release

1580d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc9ad31e44017264b78ad979be44da3b6156d0508130d0e881bf89edd2c0596d?d=identicon)[tsterker](/maintainers/tsterker)

---

Top Contributors

[![tsterker](https://avatars.githubusercontent.com/u/1156230?v=4)](https://github.com/tsterker "tsterker (7 commits)")

---

Tags

laravelsolariumsolr

### Embed Badge

![Health badge](/badges/tsterker-solarium/health.svg)

```
[![Health](https://phpackages.com/badges/tsterker-solarium/health.svg)](https://phpackages.com/packages/tsterker-solarium)
```

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k869.4M8.7k](/packages/symfony-http-kernel)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.5k](/packages/symfony-framework-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M733](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k185.6M2.3k](/packages/symfony-security-bundle)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)

PHPackages © 2026

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