victoire/search-widget
Victoire Search Widget adds a ready-to-use, configurable search UI to Laravel apps. Drop in a Blade component, connect it to your search backend, and customize styling and behavior to match your site—ideal for adding fast, flexible search without building the front end from scratch.
The widget is a Victoire CMS extension, so the first step is confirming your Victoire version — this bundle's last release (April 2019) targets Symfony 2.8/3.x and the Victoire widget API of that era.
composer require victoire/search-widget
app/AppKernel.php (Symfony 3 style — there is no Flex recipe):
new Victoire\Widget\SearchBundle\VictoireWidgetSearchBundle(),
Resources/config/config.yml, so no manual service wiring is needed. Clear the cache:
php bin/console cache:clear
First use case: drop the search widget into a header slot in a layout so every published page renders a search form. The form posts to a route you define; the widget itself is the input, not the results page.
Where to look first:
Form/WidgetSearchType.php — the editable fields exposed to editors.Entity/WidgetSearch.php — persisted widget settings.Resources/views/show.html.twig — the front-end markup.Resources/config/config.yml — widget name, category, and business-entity scope.Render the form on a Victoire page. Place the widget on a page or layout; Victoire's slot system handles placement. The widget's show.html.twig renders form_start/form_widget — override it in app/Resources/VictoireWidgetSearchBundle/views/show.html.twig to match your design system without touching the vendor tree.
Wire the results route. The widget only renders the input form. Define a controller action and route (e.g., /search) that reads the query param and renders results. Keep the search execution in your own service so the widget stays presentation-only:
public function searchAction(Request $request, SearchService $search)
{
$q = trim($request->query->get('q', ''));
$results = $q ? $search->find($q) : [];
return $this->render('search/results.html.twig', ['q' => $q, 'results' => $results]);
}
Add editor-configurable fields. Subclass WidgetSearchType and the WidgetSearch entity, add your property (e.g., resultsRoute, resultsLimit), then register your subclass as the widget's form type in the bundle config. This is the sanctioned extension point — do not edit vendor files.
Scope to a business entity. Victoire business entities (Article, Page, custom) are filterable via Victoire's repository helpers. Build a SearchService that runs a query builder over your business entity and respect the widget's stored scope so editors can restrict results per placement.
Integrate with a search backend. For anything beyond a LIKE query, swap your SearchService for an adapter over Elasticsearch / Meilisearch / database full-text. The widget config stays the same; only the service behind the route changes.
i18n. Override the bundle's translation files under app/Resources/translations/ (domain is typically victoire_widget_search). Keep translations per-locale consistent with Victoire's page locale.
AppKernel, bundle class moved, autowiring changes). For new projects, plan to fork or reimplement the widget; treat this as a starting point only.doctrine:schema:update (or a migration) — Victoire widgets persist their configuration per placement, so schema drift breaks the back office silently.victoire_core.widgets entry that mirrors the bundle's own config causes duplicate widgets in the picker. Check config.yml before adding anything.method. Verify form_start emits action and method="get" matching your results route, or the form silently posts to the current page.app/Resources/VictoireWidgetSearchBundle/views/show.html.twig exactly; a mismatched folder silently falls back to the vendor template.cache:clear first, then debug:container | grep victoire, then the Victoire widget config — the ordering of those checks saves the most time.WidgetSearch + WidgetSearchType for fields, override show.html.twig for markup, back the results route with your own service. Those three touchpoints handle almost every real requirement without forking the vendor code.How can I help you explore Laravel packages today?