PHPackages                             makinacorpus/autocomplete-bundle - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. makinacorpus/autocomplete-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

makinacorpus/autocomplete-bundle
================================

Autocomplete upload widget and form type for Symfony

1.x-dev(8y ago)35.2k↓86.7%3[3 issues](https://github.com/makinacorpus/autocomplete-bundle/issues)[1 PRs](https://github.com/makinacorpus/autocomplete-bundle/pulls)GPL-2.0-or-laterPHPCI failing

Since Mar 20Pushed 4y ago12 watchersCompare

[ Source](https://github.com/makinacorpus/autocomplete-bundle)[ Packagist](https://packagist.org/packages/makinacorpus/autocomplete-bundle)[ Docs](http://github.com/makinacorpus/autocomplete-bundle)[ RSS](/packages/makinacorpus-autocomplete-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (9)Used By (0)

Autocomplete API and Symfony widget
===================================

[](#autocomplete-api-and-symfony-widget)

This package provides:

- an almost dependency-free autocomplete source API, with a generic controller that should be suitable for most frameworks,
- a Symfony bundle that brings a form widget, source registration, and the associated controller for autocompleting things into forms.

Upgrading to 2.x
================

[](#upgrading-to-2x)

You have two fixes to make:

- First one is that the `AutocompleteSourceInterface::find()` method query argument typing changed, you must adapt your sources.
- Second is that we now support more libraries than only `select2`, so instead of including `AutocompleteBundle:Form:fields.html.twig` you must chose either one of `fields-select2.html.twig` or `fields-autocompleter.html.twig`.
- Template engine based rendering has been dropped, it's up to you to implement it properly in your sources.

Installation
============

[](#installation)

```
composer require makinacorpus/autocomplete-bundle
```

Write JavaScript code
=====================

[](#write-javascript-code)

You must implement the JavaScript part yourself, all you have to know is that you have two different inputs:

- a container with the `.tac-container` CSS class, for being more precise in selecting the component,
- a `text` type input,
- a `hidden` type input.
- both will have the `data-tac-id` attribute (which yield the same value for both inputs) and the `data-tac-role` attribute, which respectively yield the `label` and `id` values.

The `text` input also yield the `data-autocomplete-uri` which contains a generated URL for querying data (please note that URL can change in time, for security or deduplication reasons). In order to query this URL you can use the following query parameters:

- `query` which holds the user input,
- `limit` which holds the number of items to fetch,
- `page` page number (which starts at `1`).

Once you get results, and the user selects a value, you must set the return object `id` property into the `[data-tac-role="id"]` element, and the object `label` property into the `[data-tac-role="label"]` element.

Bonus point if you empty the hidden value when the users manually edit the text value.

Use a supported JavaScript library
----------------------------------

[](#use-a-supported-javascript-library)

**This autocomplete widget needs a third party library to be registered****globally in your JavaScript code**:

- [select2](https://select2.github.io) library,
- [autocompleter](https://github.com/kraaden/autocomplete) library (not implemented yet).

If you use `select2` you also need `jQuery` to be installed (any version).

Register the routing.yml file in your `app/routing.yml` file:

```
autocomplete:
    resource: "@AutocompleteBundle/Resources/config/routing.yml"
    prefix: /
```

And the associated form theme in your `app/config.yml` file:

```
twig:
    debug:            "%kernel.debug%"
    strict_variables: false
    form_themes:
        # For select2 based widget:
        - "AutocompleteBundle:Form:fields-select2.html.twig"
```

**Beware that this method is not supported anymore, it might work, it might not.**

Usage
=====

[](#usage)

First, implement an `MakinaCorpus\AutocompleteBundle\Autocomplete\AutocompleteSourceInterface`class, that is meant to reflect the business objects in which to autocomplete.

Then just use the `MakinaCorpus\AutocompleteBundle\Form\Type\TextAutocompleteType` form type in your own form builders, and set the source class name as the `source` parameter for the form type.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~235 days

Recently: every ~322 days

Total

8

Last Release

1745d ago

Major Versions

1.x-dev → 2.0.0-alpha12020-11-24

PHP version history (2 changes)2.0.0-alpha1PHP ^7.4

2.0.0-alpha4PHP &gt;= 7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/69252826f3a70a19fc5dcefb7ef9d26d465bb300245641abb4dd89d0ec391a66?d=identicon)[pounard](/maintainers/pounard)

![](https://www.gravatar.com/avatar/d21b98752b406528da88850922b1061f39bf72eb2126b413d5c12e275811a40b?d=identicon)[Makina Corpus](/maintainers/Makina%20Corpus)

---

Top Contributors

[![pounard](https://avatars.githubusercontent.com/u/341855?v=4)](https://github.com/pounard "pounard (24 commits)")[![Lonnytunes](https://avatars.githubusercontent.com/u/6373159?v=4)](https://github.com/Lonnytunes "Lonnytunes (2 commits)")[![SebCorbin](https://avatars.githubusercontent.com/u/645207?v=4)](https://github.com/SebCorbin "SebCorbin (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/makinacorpus-autocomplete-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/makinacorpus-autocomplete-bundle/health.svg)](https://phpackages.com/packages/makinacorpus-autocomplete-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[symfony/ai-bundle

Integration bundle for Symfony AI components

32642.2k24](/packages/symfony-ai-bundle)[ecotone/symfony-bundle

Ecotone for Symfony — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Symfony Messenger, via PHP attributes.

11249.0k1](/packages/ecotone-symfony-bundle)

PHPackages © 2026

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