PHPackages                             seijikun/php-sonic - 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. seijikun/php-sonic

AbandonedArchivedLibrary[Search &amp; Filtering](/categories/search)

seijikun/php-sonic
==================

PHP client for the Sonic fulltext search engine

0.0.3(7y ago)318MPL-2.0PHP

Since Mar 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/seijikun/php-sonic)[ Packagist](https://packagist.org/packages/seijikun/php-sonic)[ RSS](/packages/seijikun-php-sonic/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

php-sonic
=========

[](#php-sonic)

Synchronous PHP client library for the sonic search backend. The client is as simple as possible, in only a single file.

API
---

[](#api)

Sonic requires one to choose the type/mode of a session per connection, with no possibility of changing the selected mode later on. This results in the following API-Design: When connecting to Sonic, one chooses between the three classes `SearchSession`, `IngestSession`, `ControlSession`, of which each resembles one possible mode of operation for Sonic:

### Ingest

[](#ingest)

```
$client = new \SonicSearch\IngestSession('localhost', 1491, 'SecretPassword');
try {
        $client->connect();
} catch(\SonicSearch\SonicUnreachableException $e) {
        echo "Failed to connect to Sonic:";
        var_dump($e);
        exit;
}

// Ping sonic (to keep the session alive, e.g.)
$client->ping();

/* Ask sonic to clear the messages index */
$client->flush('messages');
// To delete more specific paths:
$client->flush('messages', 'default');
$client->flush('messages', 'default', 'conversation:x1337x');

/* Let's imagine having a chat conversation and push some messages into Sonic's index */
$client->push('messages', 'default', 'conversation:x1337x', 'Sonic sounds interesting. Lets see how it performs as backend for nextcluods fulltextsearch framework!');
$client->push('messages', 'default', 'conversation:x1337x', 'Haha nice idea! Elasticsearch is damned slow!');

/* Let's ask Sonic to count some stuff for us */
echo "Amount of collections: " . $client->count('messages');
echo "Amount of conversations: " . $client->count('messages', 'default');
echo "Amount of Terms in conversation: " . $client->count('messages', 'default', 'conversation:x1337x');
```

### Search

[](#search)

```
$client = new \SonicSearch\SearchSession('localhost', 1491, 'SecretPassword');
try {
        $client->connect();
} catch(\SonicSearch\SonicUnreachableException $e) {
        echo "Failed to connect to Sonic:";
        var_dump($e);
        exit;
}

// Ping sonic (to keep the session alive, e.g.)
$client->ping();

// Query Sonic
$results = $client->query('messages', 'default', 'Elasticsearch slow');
var_dump($results);

// Let Sonic suggest auto-completion for some words
var_dump($client->suggest('messages', 'default', 'So', 1));
```

### Control

[](#control)

```
$client = new \SonicSearch\SearchSession('localhost', 1491, 'SecretPassword');
try {
        $client->connect();
} catch(\SonicSearch\SonicUnreachableException $e) {
        echo "Failed to connect to Sonic:";
        var_dump($e);
        exit;
}

// Ping sonic (to keep the session alive, e.g.)
$client->ping();

// Query Sonic
$results = $client->query('messages', 'default', 'Elasticsearch slow');
var_dump($results);

// Let Sonic suggest auto-completion for some words
var_dump($client->suggest('messages', 'default', 'So', 1));
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Total

3

Last Release

2598d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e868906ac3227d3dbaf43f17524b3be3c8016a78402b618f8ffa4d295a7d677?d=identicon)[seijikun](/maintainers/seijikun)

---

Top Contributors

[![seijikun](https://avatars.githubusercontent.com/u/820845?v=4)](https://github.com/seijikun "seijikun (12 commits)")

---

Tags

fulltext-indexesfulltext-searchphpsonictcpsearchfulltextsonicfulltextsearch

### Embed Badge

![Health badge](/badges/seijikun-php-sonic/health.svg)

```
[![Health](https://phpackages.com/badges/seijikun-php-sonic/health.svg)](https://phpackages.com/packages/seijikun-php-sonic)
```

###  Alternatives

[teamtnt/tntsearch

A fully featured full text search engine written in PHP

3.2k3.0M28](/packages/teamtnt-tntsearch)[php-sonic/php-sonic

PHP client of Sonic search

276.5k](/packages/php-sonic-php-sonic)[ganuonglachanh/sonic

Allows to search by sonic

201.9k](/packages/ganuonglachanh-sonic)[blomstra/search

Replaces Flarum search with one powered by an elastic search server.

114.9k](/packages/blomstra-search)

PHPackages © 2026

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