Taggable symfony bundle

Installs: 621

Dependents: 2

Stars: 3

Watchers: 1

Language: PHP

v1.2.1 2014-07-18 13:54 UTC


Bundle provides integration of doctrine-extensions-taggable, adds form types for editing tag and tagging.


Install via composer with command:

$ php composer.phar require 'anh/taggable-bundle:~1.0'

Enable bundles in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Sp\BowerBundle\SpBowerBundle(),
        new Anh\TaggableBundle\AnhTaggableBundle()

    // ...

Install dependencies:

$ app/console sp:bower:install

Bundle uses SpBowerBundle for manage external assets, so installed bower is required.

Update schema:

$ app/console doctrine:schema:update --force


Building form

    public function buildForm(FormBuilderInterface $builder, array $options)
        // ...
            ->add('tags', 'tags', array(
                'tagit' => array(/* ... */), // see for available options, may be empty
                'autocomplete' => 'dynamic' // default
        // ...

autocomplete option:

  • dynamic - tags fetched dynamicaly via ajax (you may set custom url in ['tagit']['autocomplete']['source']) (limited to 100 tags)
  • static - all tags passed via attribute (limited to 100 tags)
  • custom - no tags will be provided from db (custom list of tags may be passed by setting ['tagit']['availableTags'])

Rendering form

<!doctype html>
    <link rel="stylesheet" href="//" />
    {% stylesheets
    %}<link rel="stylesheet" href="{{ asset_url }}" />{% endstylesheets %}

    <script src="//"></script>
    <script src="//"></script>
    {% javascripts
    %}<script src="{{ asset_url }}"></script>{% endjavascripts %}
    {{ form(form) }}



Bundle automatically adds mapping for Tag and Tagging entities from doctrine-extensions-taggable. If you for any reason have to disable it put in config.yml:

            anh_taggable: { mapping: false }