glitchr/typesense-bundle

This bundle provides integration with Typesense in Symfony

Maintainers

Package info

gitlab.glitchr.dev/public-repository/symfony/bundle/typesense-bundle

Type:symfony-bundle

pkg:composer/glitchr/typesense-bundle

Transparency log

Statistics

Installs: 145

Dependents: 0

Suggesters: 0

1.0 2023-09-08 00:27 UTC

This package is auto-updated.

Last update: 2026-07-08 23:56:32 UTC


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 Doctrine ClassMetadata, including single-table-inheritance sub-collections).
  • ORM/Query/ — a fluent Request/Query builder and Response wrapper.
  • 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 real typesense/typesense-php client 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