PHPackages                             lionear/solr-client - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. lionear/solr-client

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

lionear/solr-client
===================

A PHP Solr Client

1.0.0(8y ago)042MITPHPPHP ~7.1

Since Feb 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Lionear/php-solr-client)[ Packagist](https://packagist.org/packages/lionear/solr-client)[ Docs](https://www.bonkestoter.com)[ RSS](/packages/lionear-solr-client/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (7)Used By (0)

PHP Solr Client
===============

[](#php-solr-client)

This is a PHP library designed to simplify interaction with a SOLR server

This fork has been made compatible with Symfony 4, release version 1.0

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

[](#installation)

The prefered method is via composer

```
composer require lionear\php-solr-client

```

Be sure to include the autoloader

```
require_once "vendor/autoload.php"

```

Usage
-----

[](#usage)

### Quick Start

[](#quick-start)

```
$client = new SolrClient('localhost', '8983');
$client->setCore('gettingstarted');

// Adding document
$client->add(
    new SolrDocument([
        'id' => 1,
        'title_s' => 'Title'
    ]);
);
$client->commit();

// Searching document
$result = $client->query('title_s:title');
echo $result->getNumFound(); // 1
foreach ($result->getDocs() as $doc) {
    echo $doc->title_s; // 'Title'
}

// Getting a single document
$doc = $client->get(1);
echo $doc->title_s; // 'Title'
```

### Searching

[](#searching)

Search parameters can be pass to the `search()` function which would return an instance of `SolrSearchResult`

```
// Search with custom parameters
$result = $client->search([
    'q' => '+title:fish -description:shark',
    'rows' => 15,
    'start' => 0
]);

// Pagination Support
$nextPage = $result->next(15, $client);

// Facet support
$result = $solr->setFacet('subject')->query('*:*');
$subjectFacet = $result->getFacet('subject');
```

### Indexing

[](#indexing)

```
// autocommit enabled to commit after every add
$doc = new SolrDocument;
$doc->id = 2;
$doc->title_s = "Second Document";
$doc->description_s = "Some description";
$client->add($doc);
```

### Delete

[](#delete)

```
// delete by id field
$client->remove(2);

// delete by query
$client->removeByQuery('id:2');
```

### Cursor

[](#cursor)

To make use of SOLR CursorMark functionality, useful for exporting records

```
// search for all documents that has a subject field match aquatic, by 10 at a time
$search = [
    'q' => 'subject:aquatic'
];

while($payload->getNextCursorMark() != $payload->getCursorMark()) {
   $payload = $client->cursor($payload->getNextCursorMark(), 10, $search);
   print_r($payload);
}
```

### Commands

[](#commands)

To assist with common operation on an existing SOLR server

```
// List of help commands
bin/console help

// List of help commands for solr:run command
bin/console solr:run -h

// Run optimize on default SOLR instance
bin/console solr:run -d optimize

// Exports all records from collection1 to /tmp/export/ directory
bin/console solr:export -s localhost -p 8983 -c collection1 -t /tmp/export/
// Import the records to another SOLR instance
bin/console solr:import -s example.org -p 8983 -c collection2 -t /tmp/export/

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94% 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

Total

5

Last Release

3037d ago

Major Versions

0.1.8 → 1.0.02018-01-16

PHP version history (3 changes)0.1.5PHP ~5.6|~7.0

0.1.7PHP ~5.5|~7.0

1.0.0PHP ~7.1

### Community

Maintainers

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

---

Top Contributors

[![minhd](https://avatars.githubusercontent.com/u/1299993?v=4)](https://github.com/minhd "minhd (47 commits)")[![Lionear](https://avatars.githubusercontent.com/u/6653342?v=4)](https://github.com/Lionear "Lionear (3 commits)")

---

Tags

psrgenerator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lionear-solr-client/health.svg)

```
[![Health](https://phpackages.com/badges/lionear-solr-client/health.svg)](https://phpackages.com/packages/lionear-solr-client)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19462.3M1.3k](/packages/drupal-core)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)

PHPackages © 2026

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