A Symfony bundle to manage meta tags

1.0.2 2022-04-07 16:44 UTC

This package is auto-updated.

Last update: 2024-04-07 21:33:12 UTC


This bundle provides a Twig extension and an easy configurable file to customize contents of all your meta tags.


composer require longitude-one/meta-bundle


Edit your twig base view to call functions meta_description(), meta_title(), meta('foo:bar') implemented by our twig extension.


<!-- templates/base.html.twig -->
<!DOCTYPE html>
<html lang="fr">
    <meta name="description" content="{{ meta_description() }}" />
    <meta property="og:image" content="{{ meta('og:image') }}" />
    <title>{{ meta_title() }}</title>

Create or edit the bundle configuration file and

# config/packages/meta.yaml
    description: 'My default description' # the default description
    'og-image': 'My default image' # the default image
    title: 'My default title' # the default title
    '/foo/bar/': # For this url, our extension will return customs 
      description: 'My custom description for /foo/bar url'
      'og-image': 'My custom image for /foo/bar url'
      title: 'My custom title for /foo/bar url'
    '/bar': #For this url, our extension will return a custom title and the default image and title.
      title: 'My custom description for /bar url'


  • Fork the github project.
  • Clone it

A very simple docker is embedded to:

  • provide you a PHP8.1 environment
  • provide you composer, symfony and phpcsfixer as external tools
  • launch local symfony server to help you to dev

Then simply build your container:

docker-compose up --build

With your browser, you can access the embedded application by accessing the symfony local server

Update the code, fix bugs or implement new feature, then check the test.

docker exec bundle-php ./vendor/bin/phpunit

Check quality code with PHP-CS-FIXER:

docker exec bundle-php tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php-cs-fixer.php

All is OK ? commit your code, push it and pull request it ;)