glitchr / typesense-bundle
This bundle provides integration with Typesense in Symfony
Package info
gitlab.glitchr.dev/public-repository/symfony/bundle/typesense-bundle
Type:symfony-bundle
pkg:composer/glitchr/typesense-bundle
Requires
- php: ^8.0
- beberlei/doctrineextensions: ^1.0
- doctrine/doctrine-bundle: ^2.0
- doctrine/orm: ^2.0
- monolog/monolog: ^2.3
- php-http/curl-client: ^2.2
- symfony/framework-bundle: ^3.4|^4.3|^5|^6.0
- symfony/http-client-contracts: ^1.0|^2.0|^3.0
- symfony/property-access: ^3.4|^4.3|^5|^6.0
- typesense/typesense-php: ^4.8
Requires (Dev)
- phpunit/phpunit: ^9.5
- symfony/phpunit-bridge: ^5.0|^6.0
- symfony/yaml: ^3.4 || ^4.4 || ^5.4 || ^6.0
README
Symfony integration for Typesense, structured like Doctrine's own DBAL/ORM split:
DBAL/— connections, low-level client wiring, multi-server support.ORM/Mapping/— collections, metadata (derived from real DoctrineClassMetadata, including single-table-inheritance sub-collections).ORM/Query/— a fluentRequest/Querybuilder andResponsewrapper.ORM/Transformer/— entity ↔ Typesense document conversion.EventListener/TypesenseIndexer— keeps collections in sync with Doctrine entity lifecycle events automatically.
See docs/getting-started.md for a minimal,
working example, including a multi-server connection setup.
Running the tests
Two suites:
tests/Unit— no external dependencies, pure PHP + mocks. Runs anywhere PHP + this bundle's dependencies are installed.tests/Integration— exercises the realtypesense/typesense-phpclient against a real Typesense server (skips itself if none is reachable).
Locally, against the bundle's own composer install
composer install
composer test-unit # fast, no server needed
composer test-integration # needs TYPESENSE_URL / TYPESENSE_KEY pointing at a real server
composer test # both suites
composer test-coverage # HTML + text coverage report in var/coverage
Full pipeline via Docker (spins up a real Typesense server too)
docker compose -f docker-compose.test.yml run --rm test
This builds Dockerfile.test (a bare php:8.4-cli image, composer install
as its own root package — no host Symfony app needed) and starts a real,
ephemeral (tmpfs) typesense/typesense server alongside it, wired via
TYPESENSE_URL/TYPESENSE_KEY. Use this exact setup as the base for a
.gitlab-ci.yml/GitHub Actions job.
Inside a host application (dev workflow)
If this bundle is installed as a dependency (vendor/glitchr/typesense-bundle),
tests/bootstrap.php self-registers its test namespace against the host
app's own autoloader (which never picks up a dependency's autoload-dev):
docker exec -w /path/to/app/vendor/glitchr/typesense-bundle <web-container> \
php ../../symfony/phpunit-bridge/bin/simple-phpunit