Skip to content

Installation

phil/taxonomy-bundle
RequirementVersionWhy
PHP8.5 or laterThe floor the bundle declares
ext-intl, ext-mbstringanyThe request's language; names counted in characters
doctrine/orm^3.7The tables
symfony/form, symfony/options-resolver^8.2The form types
phil/slug^0.1The slugs of tag names and category keys
phil/resource^0.1ResourceReference, the resource a tag or a category is given to
symfony/uid^8.2Identifiers
symfony/dependency-injection, symfony/config^8.2The bundle class and its configuration
composer require phil/taxonomy-bundle
// config/bundles.php
return [
    // ...
    Phil\TaxonomyBundle\PhilTaxonomyBundle::class => ['all' => true],
];
# config/packages/phil_taxonomy.yaml
phil_taxonomy:
    fallback_locale: en   # the language of a name when there is none in the language asked
    slugger: ~            # the service id of the slugger of names and keys; ~ for the default one

With DoctrineBundle, the bundle maps its entities; the application's migrations create four tables:

TableColumns
phil_taxonomy_tagid, name (100), slug (128, unique)
phil_taxonomy_categoryid, category_key (128, unique), parent (restricted on delete), path (420, indexed), position
phil_taxonomy_category_translationid, category (cascades on delete), locale (16), name (150), description; unique on category and locale
phil_taxonomy_assignmentid, term_type (tag or category), term_id, resource_kind (64), resource_id (255); unique on all four, indexed on the resource