Download the PHP package javer/sphinx-bundle without Composer
On this page you can find all versions of the php package javer/sphinx-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sphinx-bundle
JaverSphinxBundle
This bundle provides integration of Sphinx search engine with Symfony.
Features:
- SphinxQL Query Builder
- Integration with doctrine/orm
- Integration with knplabs/knp-paginator-bundle
- Symfony Profiler toolbar section with number of executed queries and profiler page with detailed information about executed queries
- Ability to test search using Behat scenarios
Requirements
- PHP 8.0+
- pdo_mysql php extension
Installation
Install the bundle using composer:
Configuration
Add to your the following options:
Full configuration with default values:
Usage
Synthetic example of SELECT query which returns an array:
Paginate a list of entities fetched from the database using Doctrine ORM QueryBuilder by searching phrase in them using Sphinx:
Sample shpinx.conf for the given example above:
Behat tests
To be able to test search in Behat scenarios there is built-in behat context SphinxContext.
Installation with behat/symfony2-extension
To use it you should add this context in your behat.yml, for example:
Please note that Symfony2Extension Behat extension is required to be able to use this feature.
Installation with friends-of-behat/symfony-extension
Register SphinxDIContext in the container:
and then use it in your behat.yml:
Usage
Then you should add a new step to your scenario:
This step:
- creates a new configuration for sphinx based on your configuration
- converts all MySQL indexes to real-time indexes
- starts daemon
- loads data from the database to indexes for converted MySQL -> real-time indexes
- stops daemon at the end of the scenario
Please note that you should explicitly declare all text fields in your indexes in the following form:
It is not necessary when you declare fields for MySQL index in sphinx.conf, but it is needed to be able to convert indexes to real-time.
If you use sqlite as the database engine for running tests you should take into account that not all functions of the MySQL are presented in sqlite, so you should use portable analogs for these functions:
IF(condition, true, false)
->CASE WHEN condition THEN true ELSE false END
- and so on
Docker
You can use a docker image to run the daemon in the docker container for the test environment, just add the following configuration option to config/packages/test/javer_sphinx.yaml
:
All versions of sphinx-bundle with dependencies
ext-pcntl Version *
ext-pdo Version *
ext-posix Version *