PHPackages                             nelmio/solarium-bundle - 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. [Search &amp; Filtering](/categories/search)
4. /
5. nelmio/solarium-bundle

ActiveSymfony-bundle[Search &amp; Filtering](/categories/search)

nelmio/solarium-bundle
======================

Integration with solarium solr client.

v6.0.0(6mo ago)1503.2M↓50.5%6011MITPHPPHP ^8.2CI failing

Since Jul 31Pushed 6mo ago10 watchersCompare

[ Source](https://github.com/nelmio/NelmioSolariumBundle)[ Packagist](https://packagist.org/packages/nelmio/solarium-bundle)[ RSS](/packages/nelmio-solarium-bundle/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (8)Versions (31)Used By (11)

NelmioSolarium Bundle
=====================

[](#nelmiosolarium-bundle)

[![Latest Version](https://camo.githubusercontent.com/65390736276bdc8d16adec7924fad143da5dd7065de6b141efa4c2f2092ca467/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6e656c6d696f2f4e656c6d696f536f6c617269756d42756e646c652e7376673f7374796c653d666c61742d737175617265)](https://github.com/nelmio/NelmioSolariumBundle/releases)[![Total Downloads](https://camo.githubusercontent.com/c702a2c04e0745b99496cee871facb0e0569be18bbc6709658b7be586f3c77c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e656c6d696f2f736f6c617269756d2d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nelmio/solarium-bundle)

About
-----

[](#about)

The NelmioSolariumBundle provides integration with the [solarium](http://www.solarium-project.org)solr client.

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

[](#installation)

Require the `nelmio/solarium-bundle` package in your composer.json and update your dependencies.

```
$ composer require nelmio/solarium-bundle
```

Add the NelmioSolariumBundle to your AppKernel.php

```
public function registerBundles()
{
    $bundles = array(
        ...
        new Nelmio\SolariumBundle\NelmioSolariumBundle(),
        ...
    );
    ...
}
```

Basic configuration
-------------------

[](#basic-configuration)

Quick-start configuration:

```
nelmio_solarium: ~
```

Gives you a Solarium\_Client service with default options (`http://localhost:8983/solr`)

```
    $client = $this->get('solarium.client');
```

Configure your endpoints in config.yml:

```
nelmio_solarium:
    endpoints:
        default:
            scheme: http
            host: localhost
            port: 8983
            path: /solr
            core: active
    clients:
        default:
            endpoints: [default]
```

If you only have one endpoint, the `client` section is not necessary

Usage
-----

[](#usage)

```
$client = $this->get('solarium.client');
$select = $client->createSelect();
$select->setQuery('foo');
$results = $client->select($select);
```

For more information see the [Solarium documentation](http://solarium.readthedocs.io/en/stable/).

Multiple clients and endpoints
------------------------------

[](#multiple-clients-and-endpoints)

```
nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    clients:
        default:
            endpoints: [default]
        another:
            endpoints: [another]
```

```
    $defaultClient = $this->get('solarium.client');
    $anotherClient = $this->get('solarium.client.another');
```

You may also change `default` name with your own, but don't forget change `default_client` option if you want to get access to `solarium.client` service

```
nelmio_solarium:
    default_client: firstOne
    endpoints:
        firstOne:
            host: 192.168.1.2
        anotherOne:
            host: 192.168.1.3
    clients:
        firstOne:
            endpoints: [firstOne]
        anotherOne:
            endpoints: [anotherOne]
```

```
    $firstOneClient = $this->get('solarium.client');
    //or
    $firstOneClient = $this->get('solarium.client.firstOne');

    $anotherOneClient = $this->get('solarium.client.anotherOne');
```

Starting from Solarium 3.x you can also have multiple endpoints within the same client

```
nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    # if you are using all the endpoints, the clients section is not necessary
    clients:
        default:
            endpoints: [default, another]
```

You can also set which is the default endpoint

```
nelmio_solarium:
    endpoints:
        default:
            host: 192.168.1.2
        another:
            host: 192.168.1.3
    clients:
        default:
            endpoints: [default, another]
            default_endpoint: another
```

You can combine both multiple client and endpoints too

```
nelmio_solarium:
    endpoints:
        one:
            host: 192.168.1.2
        two:
            host: 192.168.1.3
        three:
            host: 192.168.1.4
    clients:
        firstOne:
            endpoints: [one, two]
            default_endpoint: two
        secondOne:
            endpoints: [two, three]
            default_endpoint: three
```

Client registry
---------------

[](#client-registry)

You can also use the service `solarium.client_registry` to access the clients you have configured using the names you have used in the configuration (with the example above):

```
$registry = $this->get('solarium.client_registry');
$firstOne = $registry->getClient('firstOne');
$secondOne = $registry->getClient('secondOne');
```

or if you have configured a default client

```
$registry = $this->get('solarium.client_registry');
$default = $registry->getClient();
```

Plugins
-------

[](#plugins)

Solarium works with plugins. If you want to use your own plugins, you can register a plugin in the bundle configuration either with a service id or the plugin class:

```
nelmio_solarium:
    clients:
        default:
            plugins:
                test_plugin_service:
                    plugin_service: plugin _service_id
                test_plugin_classname:
                    plugin_class: Some\Plugin\TestPlugin
```

Overriding the Client class
---------------------------

[](#overriding-the-client-class)

To change the client class, you can set the client\_class option:

```
nelmio_solarium:
    clients:
        default:
            client_class: Solarium\Core\Client
```

Customizing the HTTP Adapter used by the Client
-----------------------------------------------

[](#customizing-the-http-adapter-used-by-the-client)

If you need to customize the Adapter that is used by the Client to perform HTTP requests to Solr then you can use the `adapter_service` option to specify the ID of a symfony service to be used as an adapter:

```
nelmio_solarium:
    clients:
        default:
            adapter_service: 'my.custom.adapter.service'
```

HTTP Request timeout
--------------------

[](#http-request-timeout)

If you are using the default adapter (`Curl`) and did not customize the `adapter_service` then you can use the `adapter_timeout` option to customize the timeout. Solarium uses a timeout of 5 seconds by default.

```
nelmio_solarium:
    clients:
        default:
            adapter_timeout: 10
```

Loadbalancer Plugin
-------------------

[](#loadbalancer-plugin)

Solarium ships with a loadbalancer plugin which can be configured via the `load_balancer` option on the client level.

Passing a list of endpoints will assign equal weights of 1 and randomly pick an endpoint for each request.

```
nelmio_solarium:
    endpoints:
        one:
            host: 192.168.1.2
        two:
            host: 192.168.1.3
        three:
            host: 192.168.1.4
    clients:
        default:
            load_balancer:
                enabled: true
                endpoints: [ one, two, three ] # will assign equal weights of 1
```

You can also assign different weights (integers &gt;= 1) to the endpoints to have a more fine-grained control over the loadbalancing. There are also options to customize the blocked query types and the default endpoint to use for those queries.

```
nelmio_solarium:
    endpoints:
        one:
            host: 192.168.1.2
        two:
            host: 192.168.1.3
        three:
            host: 192.168.1.4
    clients:
        default:
            default_endpoint: two # the default endpoint to use for blocked query types
            load_balancer:
                enabled: true
                blocked_query_types: [ 'select', 'update' ] # default is [ 'update' ]
                endpoints:
                    one: 1
                    two: 2 # this endpoint will be used twice as often as the other two
                    three: 1
```

Also see the Solarium documentation for the loadbalancer plugin:

License
-------

[](#license)

Released under the MIT License, see LICENSE.

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance66

Regular maintenance activity

Popularity60

Solid adoption and visibility

Community38

Small or concentrated contributor base

Maturity86

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~168 days

Recently: every ~231 days

Total

30

Last Release

198d ago

Major Versions

v2.4.0 → v3.0.0-beta2018-01-12

2.4.x-dev → v3.0.02019-06-18

3.x-dev → v4.0.0-rc.12019-12-16

v4.1.0 → v5.0.02021-11-16

v5.2.0 → v6.0.02025-12-16

PHP version history (6 changes)v3.0.0-betaPHP &gt;=5.5

3.0.0-beta.3PHP ^7.1

v4.0.0-rc.1PHP ^7.2

v5.0.0PHP ^7.3 || ^8.0

v5.2.0PHP ^8.1

v6.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/183678?v=4)[Jordi Boggiano](/maintainers/Seldaek)[@Seldaek](https://github.com/Seldaek)

---

Top Contributors

[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (66 commits)")[![dmaicher](https://avatars.githubusercontent.com/u/921145?v=4)](https://github.com/dmaicher "dmaicher (36 commits)")[![thePanz](https://avatars.githubusercontent.com/u/226021?v=4)](https://github.com/thePanz "thePanz (34 commits)")[![igorw](https://avatars.githubusercontent.com/u/88061?v=4)](https://github.com/igorw "igorw (16 commits)")[![wiistriker](https://avatars.githubusercontent.com/u/967817?v=4)](https://github.com/wiistriker "wiistriker (12 commits)")[![shieldo](https://avatars.githubusercontent.com/u/97280?v=4)](https://github.com/shieldo "shieldo (6 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (3 commits)")[![uwej711](https://avatars.githubusercontent.com/u/648874?v=4)](https://github.com/uwej711 "uwej711 (3 commits)")[![acasademont](https://avatars.githubusercontent.com/u/825021?v=4)](https://github.com/acasademont "acasademont (2 commits)")[![benjamindulau](https://avatars.githubusercontent.com/u/430689?v=4)](https://github.com/benjamindulau "benjamindulau (2 commits)")[![smoench](https://avatars.githubusercontent.com/u/183530?v=4)](https://github.com/smoench "smoench (2 commits)")[![ro0NL](https://avatars.githubusercontent.com/u/1047696?v=4)](https://github.com/ro0NL "ro0NL (1 commits)")[![royopa](https://avatars.githubusercontent.com/u/442991?v=4)](https://github.com/royopa "royopa (1 commits)")[![Rubinum](https://avatars.githubusercontent.com/u/5645798?v=4)](https://github.com/Rubinum "Rubinum (1 commits)")[![m0ppers](https://avatars.githubusercontent.com/u/819421?v=4)](https://github.com/m0ppers "m0ppers (1 commits)")[![JoeKre](https://avatars.githubusercontent.com/u/9037466?v=4)](https://github.com/JoeKre "JoeKre (1 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (1 commits)")[![ipf](https://avatars.githubusercontent.com/u/557076?v=4)](https://github.com/ipf "ipf (1 commits)")[![harmstyler](https://avatars.githubusercontent.com/u/1421469?v=4)](https://github.com/harmstyler "harmstyler (1 commits)")[![vierbergenlars](https://avatars.githubusercontent.com/u/1194648?v=4)](https://github.com/vierbergenlars "vierbergenlars (1 commits)")

---

Tags

phpsolariumsymfonysymfony-bundlesearchsolrsolarium

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

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

PHPackages © 2026

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