Download the PHP package acseo/typesense-bundle without Composer
On this page you can find all versions of the php package acseo/typesense-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download acseo/typesense-bundle
More information about acseo/typesense-bundle
Files in acseo/typesense-bundle
Package typesense-bundle
Short Description This bundle provides integration with Typesense in Symfony
License MIT
Informations about the package typesense-bundle
ACSEOTypesenseBundle
This bundle provides integration with Typesense with Symfony.
It relies on the official TypeSense PHP package
Features include:
- Doctrine object transformer to Typesense indexable data
- Usefull services to search in collections
- Listeners for Doctrine events for automatic indexing
Installation
Install the bundle using composer
`
Enable the bundle in you Symfony project
Configuration
Configure the Bundle
You can use basic types supported by Typesense for your fields : string, int32, float, etc. You can also use specific type names, such as : primary, collection, object
Data conversion from Doctrine entity to Typesense data is managed by ACSEO\TypesenseBundle\Transformer\DoctrineToTypesenseTransformer
Usage
Create index and populate data
This bundle comes with useful commands in order to create and index your data
Search documents
This bundle creates dynamic generic finders services that allows you to query Typesense
The finder services are named like this : typesense.finder.collection_name
You can inject the generic finder in your Controller or into other services.
You can also create specific finder for a collection. See documentation below.
Querying Typesense
The class TypesenseQuery()
class takes 2 arguments :
- The search terme (
q
) - The fields to search on (
queryBy
)
You can create more complex queries using all the possible Typsense search arguments
Create specific finder for a collection
You can easily create specific finders for each collection that you declare.
This configuration will create a service named @typesense.finder.books.books_autocomplete
.
You can inject the specific finder in your Controller or into other services
and then use it like this :
Use different kind of services
This bundles creates different services that you can use in your Controllers or anywhere you want.
typesense.client
: the basic client inherited from the officialtypesense-php
packagetypesense.collection_client
: this service allows you to do basic actions on collections, and allows to performsearch
andmultisearch
action.typesense.finder.*
: this generated service allows you to performquery
orrawQuery
on a specific collection. Example of a generated service :typesense.finder.candidates
typesense.specificfinder.*.*
: this generated service allows you to run pre-configured requests (declared in :config/packages/acseo_typesense.yml
). Example of a generated service :typesense.specificfinder.candidates.default
Note : there a other services. You can use the debug:container
command in order to see all of them.
Doctrine Listeners
Doctrine listeners will update Typesense with Entity data during the following events :
- postPersist
- postUpdate
- preDelete
Perform multisearch
You can create multisearch requests and get results using the collectionClient
service.
Cookbook
- Use Typesense to make an autocomplete field
Testing the Bundle
tests are written in the tests
directory.
- Unit tests doesn't require a running Typesense server
- Functional tests require a running Typesense server
You can launch the tests with the following commands :
All versions of typesense-bundle with dependencies
doctrine/orm Version ^2.8 || ^3.2
symfony/framework-bundle Version ^4.3|^5|^6.0|^7.0
symfony/console Version ^4.3.4|^5|^6.0|^7.0
typesense/typesense-php Version ^4.1.0
php-http/curl-client Version ^2.2
monolog/monolog Version ^2.3|^3.0
symfony/property-access Version ^3.4|^4.3|^5|^6.0|^7.0
symfony/http-client Version ^5.4|^6.2|^7.0