- How do I install SymKit Search Bundle with Composer?
- Run composer require symkit/search-bundle in your Symfony project. With Symfony Flex the bundle is usually registered automatically; otherwise enable it in config/bundles.php. Then create a config/packages/symkit_search.yaml file to declare your searchable Doctrine entities and fields. Doctrine ORM must already be installed and configured, since the bundle indexes and queries entities through it.
- Does SymKit Search Bundle work with Laravel?
- No. SymKit Search Bundle is a Symfony bundle that relies on Symfony's bundle system, service container and YAML/PHP configuration, so it cannot be dropped into a Laravel application. For Laravel projects you would use something like Laravel Scout with a driver such as Meilisearch, Algolia or the database engine. It is a good fit only if your application is built on Symfony.
- How do I configure which Doctrine entities and fields are searchable?
- Searchable models are declared in the bundle configuration, either as YAML in config/packages or as PHP config, where you list each entity class and the fields to index. Only the entities and properties you register are exposed to the search layer. This keeps indexing explicit and avoids accidentally querying columns you did not intend to expose. Clear the cache after changing the configuration so the container picks up the new definitions.
- Can I search across multiple entities at the same time?
- Yes. Multi-entity search is a core feature: the bundle can query across all configured Doctrine models and return combined, normalized results. This is useful for a global search box that spans products, articles and pages in one request. You can still restrict a query to a single entity when you need a scoped search page.
- How do I paginate search results?
- Search queries are built through Doctrine's query builder, so the result set is pagination-ready and can be plugged into your paginator of choice. Typically you pass the query or result object to a paginator such as KnpPaginatorBundle or Symfony's own paginator. Sorting and filtering are applied through the query builder integration before pagination, so page counts stay correct.
- How do I display search results in a Twig template?
- The bundle ships Twig and controller helpers so you can run a search from a controller and render the results without writing boilerplate service wiring. You inject or fetch the search service, pass the result set to your template, and loop over it as usual. Filters and sort parameters can be read from the request query string and forwarded to the search call.
- Can I use Elasticsearch, Meilisearch or a custom engine as the backend?
- The backend layer is extensible by design, so you can implement an adapter for a custom search engine and register it as a service. Your adapter handles indexing and querying, while the bundle keeps the configuration, Doctrine integration and helper layer consistent. This lets you start with the default Doctrine-based backend and move to an external engine later without changing your controllers or templates.
- Which Symfony and PHP versions does SymKit Search Bundle support?
- Version constraints live in the package's composer.json, so check the require section on Packagist or in the repository before installing. Because it integrates with Doctrine ORM and Symfony's service container, it targets maintained Symfony releases and matching PHP versions. When upgrading Symfony, run composer update symkit/search-bundle and re-run your test suite to confirm compatibility.
- Is SymKit Search Bundle suitable for production with large datasets?
- For moderate data volumes the Doctrine-based query builder approach performs well, especially with indexes on the columns you filter and sort on. For millions of rows or fuzzy, relevance-ranked full-text matching, a dedicated engine such as Elasticsearch or Meilisearch is usually the better choice, and the bundle's backend layer lets you plug one in. Always benchmark with realistic data and watch the generated SQL for missing indexes.
- How should I test search functionality in a Symfony application?
- Use Symfony's KernelTestCase or WebTestCase with a dedicated test database, load fixtures for the entities you configured, and assert on the returned result sets. Because the bundle queries Doctrine directly, functional tests give the most realistic coverage of filtering, sorting and pagination. Keep unit tests for any custom backend adapter you write, mocking the underlying engine client.