PHPackages                             ttf/sphinx - 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. ttf/sphinx

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

ttf/sphinx
==========

0.1.3(13y ago)15651[1 PRs](https://github.com/Kwisatz/sphinx/pulls)GPL-3.0+PHPPHP &gt;=5.3.0

Since Apr 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Kwisatz/sphinx)[ Packagist](https://packagist.org/packages/ttf/sphinx)[ RSS](/packages/ttf-sphinx/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

SphinxServiceProvider
=====================

[](#sphinxserviceprovider)

This is a simple service provider for silex that ties the SphinxSearch-API in.

A word of warning
-----------------

[](#a-word-of-warning)

This is currently work in progress and not suitable for use in productive environments.

The API may change often and erratically. Generally, I would advise against using this before version 1.0.0

I you'd really like to use this productively, I recommend to choose a version and stick with it, i.e. set "require 'ttf/sphinx': '0.1.2'" in your composer.json

Usage
-----

[](#usage)

Register the service provider as you would any other:

```
$app->register( new Ttf\SphinxServiceProvider());

```

If you're running the sphinx searchd on any host/port combination other than the assumed "localhost:3312", you need to supply these parameters here:

```
$app->register( new Ttf\SphinxServiceProvider(), array(
    'sphinx.port' => 3413,
    'sphinx.host' => 'sphinx.example.org'
));

```

Following that, you would use it as any other service provider. Start off by using the search method on the provider, which will return a result object:

```
$app->get('/search', function( Request $request ) use ($app) {
    $result = $app['sphinx']->search( $request->get('q'), 'myCatalog' );
    return new Response( (String) $result, 200 );
});

```

Coercing the $result object to a string will return a human readable representation of your research results.

In this case, a call request would look like:

```
http://silex.local/search?q=cheese

```

A more elaborate example would be:

```
$app->get('/search', function( Request $request ) use ($app) {
    if( $result = $app['sphinx']->search( $request->get('q'), 'catalog' ) ) {
        $indices = $result->fetchIndices();

        $query = 'Select description, tags from stand where fiorg = ?';
        foreach( $indices as $index ) {
            $entries = $app['db']->fetchAssoc( $query, array( $index ));
        }
        $app['twig']->render('search.twig',
            array(
                'results' => $entries
            )
        );
    }
});

```

Passing parameters to the Sphinx API
------------------------------------

[](#passing-parameters-to-the-sphinx-api)

Note that you can also directly pass arguments to the sphinxsearch api. Simply use them on the service:

```
$app['sphinx']->SetRankingMode( SPH_RANK_SPH04 );
$app['sphinx']->SetFieldWeights( array( 'tags' => 10, 'description' => 5) );

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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

4812d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6440c9af3ba24931748051967b16ecc2fb7f7c7e0a741b6b25c3449277b4b7b9?d=identicon)[kwisatz](/maintainers/kwisatz)

---

Top Contributors

[![kwisatz](https://avatars.githubusercontent.com/u/237949?v=4)](https://github.com/kwisatz "kwisatz (8 commits)")

---

Tags

searchsphinxSphinx Searchserviceprovider

### Embed Badge

![Health badge](/badges/ttf-sphinx/health.svg)

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

###  Alternatives

[nilportugues/sphinx-search

Fully unit tested SphinxClient (SphinxAPI) for PHP5.3 and above to be used with SphinxSearch

24458.5k2](/packages/nilportugues-sphinx-search)[ripaclub/sphinxsearch

Sphinx Search library provides SphinxQL indexing and searching features

6232.3k3](/packages/ripaclub-sphinxsearch)[javer/sphinx-bundle

Provides integration of Sphinx search engine with Symfony using SphinxQL

24191.8k](/packages/javer-sphinx-bundle)

PHPackages © 2026

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