PHPackages                             mezcalito/ux-search - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. mezcalito/ux-search

ActiveSymfony-bundle[Search &amp; Filtering](/categories/search)

mezcalito/ux-search
===================

Effortless search and faceted search with Symfony UX and Mezcalito UX Search

0.5.4(3mo ago)6611.1k↓42.9%5[7 issues](https://github.com/Mezcalito/ux-search/issues)[3 PRs](https://github.com/Mezcalito/ux-search/pulls)MITPHPPHP &gt;=8.3CI passing

Since Jan 22Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/Mezcalito/ux-search)[ Packagist](https://packagist.org/packages/mezcalito/ux-search)[ Docs](https://github.com/Mezcalito/ux-search)[ RSS](/packages/mezcalito-ux-search/feed)WikiDiscussions 0.x Synced 1mo ago

READMEChangelog (10)Dependencies (27)Versions (30)Used By (0)

Mezcalito UX Search
===================

[](#mezcalito-ux-search)

[![Latest Version](https://camo.githubusercontent.com/74f09671446dffa5e1583f61704f2735dc511a62c9b57467374e233408bf5c2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d657a63616c69746f2f75782d7365617263682e737667)](https://packagist.org/packages/mezcalito/ux-search)[![License](https://camo.githubusercontent.com/fd86f050b2063d828af37bd1068cd419010c3267370ddd83f60bdc99536417d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d657a63616c69746f2f75782d7365617263682e737667)](https://github.com/mezcalito/ux-search/blob/main/LICENSE)[![PHP Version](https://camo.githubusercontent.com/04995230d750b57c800207f5a76a3b21750140517ba0d54ae58557ec9522a814/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d657a63616c69746f2f75782d7365617263682e737667)](https://packagist.org/packages/mezcalito/ux-search)

A powerful, flexible, and easy-to-use search and faceted search system for Symfony applications, built with Twig Components and Live Components.

[![Effortless search and faceted search with Symfony UX and Mezcalito UX Search](docs/image/preview.png)](https://ux-search.mezcalito.dev/)

**[View Live Demo](https://ux-search.mezcalito.dev/demo)** | **[Documentation](docs/)** | **[Report Issues](https://github.com/mezcalito/ux-search/issues)**

---

Why Use This Bundle?
--------------------

[](#why-use-this-bundle)

- **🚀 Quick Setup**: Get a working search in minutes with the maker command
- **🔌 Multiple Adapters**: Support for Algolia, Meilisearch, and Doctrine ORM
- **🎨 Fully Customizable**: Override templates and components to match your design
- **⚡ Live Updates**: Built with Symfony UX Live Components for reactive UI
- **🎯 Faceted Search**: Rich filtering with refinement lists, range sliders, and more
- **📦 Production Ready**: Used in production with comprehensive test coverage

Features
--------

[](#features)

- **Multiple Search Configurations**: Create and manage multiple searches, each with its own unique configuration
- **Flexible Adapters**:
    - **Algolia**: Cloud-based search with advanced features
    - **Meilisearch**: Self-hosted open-source search engine
    - **Doctrine ORM**: Use your existing database for small datasets
- **Rich UI Components**: Pre-built components for search input, facets, pagination, sorting, and more
- **Faceted Navigation**: Multiple facet types (refinement lists, range inputs, range sliders)
- **Live Components**: Real-time updates without page reloads
- **Event System**: Customize search behavior with pre/post search events
- **SEO Friendly**: URL rewriting support for search parameters
- **Customizable**: Override any template or extend any component

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Symfony 6.4+ or 7.0+ or 8.0+
- Symfony UX (Live Components, Twig Components)

Installation
------------

[](#installation)

Install the bundle via Composer:

```
composer require mezcalito/ux-search
```

If you're **not** using Symfony Flex, you'll need to manually register the bundle in `config/bundles.php`:

```
// config/bundles.php
return [
    // ...
    Mezcalito\UxSearchBundle\MezcalitoUxSearchBundle::class => ['all' => true],
];
```

Quick Start
-----------

[](#quick-start)

### 1. Configure an Adapter

[](#1-configure-an-adapter)

Create a configuration file `config/packages/mezcalito_ux_search.yaml`:

```
mezcalito_ux_search:
    default_adapter: 'default'
    adapters:
        default: '%env(MEZCALITO_UX_SEARCH_DEFAULT_DSN)%'
```

Add the DSN to your `.env` file (choose one):

```
# For Algolia
MEZCALITO_UX_SEARCH_DEFAULT_DSN=algolia://YOUR_API_KEY@YOUR_APP_ID

# For Meilisearch
MEZCALITO_UX_SEARCH_DEFAULT_DSN=meilisearch://YOUR_MASTER_KEY@localhost:7700

# For Doctrine ORM
MEZCALITO_UX_SEARCH_DEFAULT_DSN=doctrine://default
```

### 2. Create Your First Search

[](#2-create-your-first-search)

Use the maker command to generate a search class:

```
php bin/console make:search
```

The command will ask you for:

- **Index name**: For Algolia/Meilisearch, the index name. For Doctrine, the entity FQCN (e.g., `App\Entity\Product`)
- **Search name** (optional): Custom name for your search (defaults to class name without "Search" suffix)
- **Adapter** (optional): Which adapter to use (defaults to `default_adapter`)

This creates a search class in `src/Search/` that you can customize.

### 3. Render the Search in Your Template

[](#3-render-the-search-in-your-template)

In any Twig template:

```
{# Using Twig component syntax #}

{# Or using component function #}
{{ component('Mezcalito:UxSearch:Layout', { name: 'product' }) }}
```

That's it! You now have a working search with facets, pagination, and live updates. 🎉

Choosing an Adapter
-------------------

[](#choosing-an-adapter)

Three adapters are available, each with different strengths:

AdapterBest ForPerformanceCostSetup Complexity**Algolia**Production, large datasets⭐⭐⭐💰 PaidEasy**Meilisearch**Self-hosted production⭐⭐⭐🆓 FreeMedium**Doctrine**Development, small datasets⭐⭐🆓 FreeVery Easy### Adapter DSN Format

[](#adapter-dsn-format)

AdapterDSN FormatDocumentationAlgolia`algolia://apiKey@appId`[View docs](docs/usage/algolia.md)Meilisearch`meilisearch://key@host:port`[View docs](docs/usage/meilisearch.md)Doctrine`doctrine://entityManagerName`[View docs](docs/usage/doctrine.md)**Need another provider?** You can [create your own adapter](docs/create-own-adapter.md).

Customizing Your Search
-----------------------

[](#customizing-your-search)

### Adding Facets, Sorting, and More

[](#adding-facets-sorting-and-more)

Once you've created a search class, customize it by editing the `build()` method:

```
use Mezcalito\UxSearchBundle\Search\AbstractSearch;
use Mezcalito\UxSearchBundle\Attribute\AsSearch;
use Mezcalito\UxSearchBundle\Twig\Components\Facet\RangeInput;

#[AsSearch(index: 'products', adapter: 'default')]
class ProductSearch extends AbstractSearch
{
    public function build(array $options = []): void
    {
        // Add facets for filtering
        $this->addFacet('brand', 'Brand');
        $this->addFacet('category', 'Category');
        $this->addFacet('price', 'Price', RangeInput::class);

        // Add sorting options
        $this->addAvailableSort('name', 'Name');
        $this->addAvailableSort('price', 'Price');
        $this->addAvailableSort('created_at', 'Newest');

        // Configure pagination
        $this->setAvailableHitsPerPage([12, 24, 48]);

        // Adapter-specific parameters
        $this->setAdapterParameters([
            // Adapter-specific options here
        ]);
    }
}
```

📖 **[Full customization guide](docs/usage/customize-your-search.md)**

### Customizing the UI

[](#customizing-the-ui)

The bundle provides a complete set of UI components that you can use individually or override:

#### Core Components

[](#core-components)

ComponentDescriptionDocumentation**Layout**Root wrapper component containing all search elements[Docs](docs/components/Layout.md)**SearchInput**Text search input with live updates[Docs](docs/components/SearchInput.md)**Hits**Display search results with customizable item templates[Docs](docs/components/Hits.md)**Pagination**Navigate through search results[Docs](docs/components/Pagination.md)#### Facet Components

[](#facet-components)

ComponentDescriptionDocumentation**RefinementList**Checkbox/radio list for categorical filtering[Docs](docs/components/Facet/RefinementList.md)**RangeInput**Min/max input fields for numeric ranges[Docs](docs/components/Facet/RangeInput.md)**RangeSlider**Slider for numeric range filtering[Docs](docs/components/Facet/RangeSlider.md)#### Utility Components

[](#utility-components)

ComponentDescriptionDocumentation**CurrentRefinements**Display active filters with remove buttons[Docs](docs/components/CurrentRefinements.md)**ClearRefinements**Button to clear all active filters[Docs](docs/components/ClearRefinements.md)**SortBy**Dropdown to change sort order[Docs](docs/components/SortBy.md)**TotalHits**Display total number of results[Docs](docs/components/TotalHits.md)### Overriding Templates

[](#overriding-templates)

You can override any component template by creating a file in your app's `templates/` directory:

```
templates/
└── components/
    └── Mezcalito/
        └── UxSearch/
            ├── Layout.html.twig          # Override the main layout
            ├── SearchInput.html.twig     # Override search input
            ├── Hits.html.twig            # Override results display
            └── Facet/
                └── RefinementList.html.twig

```

### Custom Hit Template

[](#custom-hit-template)

The most common customization is the hit (result item) template. Override `Hits.html.twig`:

```
{# templates/components/Mezcalito/UxSearch/Hits.html.twig #}

    {% for hit in this.resultSet.hits %}

            {{ hit.name }}
            {{ hit.price|format_currency('EUR') }}
            View details

    {% endfor %}

```

Advanced Usage
--------------

[](#advanced-usage)

### Event System

[](#event-system)

Customize search behavior with event subscribers:

```
use Mezcalito\UxSearchBundle\Event\PreSearchEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class SearchSubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            PreSearchEvent::class => 'onPreSearch',
        ];
    }

    public function onPreSearch(PreSearchEvent $event): void
    {
        $query = $event->getQuery();
        // Modify the query before search execution
        $query->addFilter('status', 'published');
    }
}
```

📖 **[Event system documentation](docs/usage/customize-your-search.md#event-subscribers)**

### Multiple Search Configurations

[](#multiple-search-configurations)

You can have multiple search configurations in one application:

```
// Product search with Algolia
#[AsSearch(index: 'products', adapter: 'algolia')]
class ProductSearch extends AbstractSearch { }

// Blog search with Meilisearch
#[AsSearch(index: 'posts', adapter: 'meilisearch')]
class BlogSearch extends AbstractSearch { }

// User search with Doctrine
#[AsSearch(index: 'App\Entity\User', adapter: 'orm')]
class UserSearch extends AbstractSearch { }
```

Each search can have its own adapter, facets, and configuration.

Documentation
-------------

[](#documentation)

### Getting Started

[](#getting-started)

- [Installation &amp; Quick Start](#installation)
- [Choosing an Adapter](#choosing-an-adapter)
- [Customizing Your Search](#customizing-your-search)

### Adapters

[](#adapters)

- [Algolia Configuration](docs/usage/algolia.md)
- [Meilisearch Configuration](docs/usage/meilisearch.md)
- [Doctrine Configuration](docs/usage/doctrine.md)
- [Creating a Custom Adapter](docs/create-own-adapter.md)

### Components

[](#components)

- [Layout](docs/components/Layout.md) - Root wrapper
- [SearchInput](docs/components/SearchInput.md) - Search box
- [Hits](docs/components/Hits.md) - Results display
- [Pagination](docs/components/Pagination.md) - Page navigation
- [Facets](docs/components/) - All facet components
- [View all components](docs/components/)

### Advanced

[](#advanced)

- [Customizing Your Search](docs/usage/customize-your-search.md) - Facets, sorting, events
- [Component Customization](docs/components/) - Override templates and behavior

Contributing
------------

[](#contributing)

Contributions are welcome! Here's how you can help:

1. **Report bugs** - [Open an issue](https://github.com/mezcalito/ux-search/issues) with a clear description
2. **Request features** - [Suggest new features](https://github.com/mezcalito/ux-search/issues) with use cases
3. **Submit PRs** - Fork, create a feature branch, and submit a pull request
4. **Improve docs** - Documentation improvements are always appreciated

### Development Setup

[](#development-setup)

```
# Clone the repository
git clone https://github.com/mezcalito/ux-search.git
cd ux-search

# Start the Docker development environment
make up

# Install dependencies
make install

# Run tests
make test

# Run code quality checks
make ci
```

Support
-------

[](#support)

- **Issues**: [GitHub Issues](https://github.com/mezcalito/ux-search/issues)
- **Discussions**: [GitHub Discussions](https://github.com/mezcalito/ux-search/discussions)
- **Demo**: [Live Demo](https://ux-search.mezcalito.dev/demo)

License
-------

[](#license)

This bundle is released under the [MIT License](LICENSE).

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance82

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~19 days

Recently: every ~1 days

Total

21

Last Release

98d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/911eee5cdea5a7a363c88e69d05e828b21e544ebdf573df9f887e72b2c6f0eb8?d=identicon)[LoicSapone](/maintainers/LoicSapone)

![](https://avatars.githubusercontent.com/u/193469?v=4)[Julien Jacottet](/maintainers/julienj)[@julienj](https://github.com/julienj)

![](https://www.gravatar.com/avatar/582573cebeeaa82d77a0e84fc4ae5a1bef63a77cd22c75e9d27be549c237eb3d?d=identicon)[mezcalito](/maintainers/mezcalito)

---

Top Contributors

[![AlexandrePetrone](https://avatars.githubusercontent.com/u/6663426?v=4)](https://github.com/AlexandrePetrone "AlexandrePetrone (53 commits)")[![daFish](https://avatars.githubusercontent.com/u/150416?v=4)](https://github.com/daFish "daFish (7 commits)")[![julienj](https://avatars.githubusercontent.com/u/193469?v=4)](https://github.com/julienj "julienj (3 commits)")[![robinsimonklein](https://avatars.githubusercontent.com/u/36634414?v=4)](https://github.com/robinsimonklein "robinsimonklein (3 commits)")[![loicsapone](https://avatars.githubusercontent.com/u/4466694?v=4)](https://github.com/loicsapone "loicsapone (2 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

algoliafaceted-searchmeilisearchsearchsymfonysymfony-bundlesymfony-uxsearchmeilisearchsymfony-uxlistingfaceted search

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mezcalito-ux-search/health.svg)

```
[![Health](https://phpackages.com/badges/mezcalito-ux-search/health.svg)](https://phpackages.com/packages/mezcalito-ux-search)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
