Download the PHP package ttf/sphinx without Composer

On this page you can find all versions of the php package ttf/sphinx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package sphinx

SphinxServiceProvider

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

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

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

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) );

All versions of sphinx with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
neutron/sphinxsearch-api Version ~2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ttf/sphinx contains the following files

Loading the files please wait ....