PHPackages                             minhd/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. minhd/solr-client

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

minhd/solr-client
=================

A PHP Solr Client

0.1.8(9y ago)11.4k↓89.4%1MITPHPPHP ~5.5|~7.0

Since Feb 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/minhd/php-solr-client)[ Packagist](https://packagist.org/packages/minhd/solr-client)[ Docs](https://github.com/minhd/phpgen)[ RSS](/packages/minhd-solr-client/feed)WikiDiscussions master Synced 3w ago

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

[![Build Status](https://camo.githubusercontent.com/04603328e4c91ea24ee2918da6ee49225099128ba76aba3f393399af44c49f44/68747470733a2f2f7472617669732d63692e6f72672f6d696e68642f7068702d736f6c722d636c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/minhd/php-solr-client)

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

[](#php-solr-client)

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

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

[](#installation)

The prefered method is via composer

```
composer require minhd\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

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

3398d ago

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

0.1.7PHP ~5.5|~7.0

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

psrgenerator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M514](/packages/shopware-core)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[drupal/core

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

19564.8M1.6k](/packages/drupal-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M396](/packages/drupal-core-recommended)

PHPackages © 2026

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