PHPackages                             t3g/symfony-template-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. [Templating &amp; Views](/categories/templating)
4. /
5. t3g/symfony-template-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

t3g/symfony-template-bundle
===========================

TYPO3 Template Bundle

5.1.2(3mo ago)520.0k4[11 PRs](https://github.com/TYPO3GmbH/symfony-template-bundle/pulls)MITTwigPHP ^8.1CI failing

Since Dec 20Pushed 2mo ago6 watchersCompare

[ Source](https://github.com/TYPO3GmbH/symfony-template-bundle)[ Packagist](https://packagist.org/packages/t3g/symfony-template-bundle)[ Docs](http://www.typo3.com)[ RSS](/packages/t3g-symfony-template-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (19)Versions (69)Used By (0)

Symfony Template Bundle
=======================

[](#symfony-template-bundle)

This package is used across various TYPO3 Symfony Applications to ensure a streamlined visual experience and reduced maintenance.

- [Symfony Template Bundle](#symfony-template-bundle)
- [Installation](#installation)
- [Configuration](#configuration)
    - [Encore](#encore)
    - [Extending Menus](#extending-menus)
        - [Dividing Menus](#dividing-menus)
- [Page Template](#page-template)
    - [Available Blocks](#available-blocks)
        - [`title`](#title)
        - [`headline`](#headline)
        - [`body`](#body)
        - [`footer`](#footer)
        - [`stylesheets`](#stylesheets)
        - [`javascripts`](#javascripts)
- [EMail Template](#email-template)
    - [Available Blocks](#available-blocks-1)
        - [`email_subject`](#email_subject)
        - [`email_plaintext`](#email_plaintext)
        - [`email_html_preview`](#email_html_preview)
        - [`email_html_body`](#email_html_body)
- [Utilities](#utilities)
    - [AvatarUtility::getAvatar(string $email, int $size)](#avatarutilitygetavatarstring-email-int-size)
    - [AvatarUtility::getAvatarUrl(string $email, int $size)](#avatarutilitygetavatarurlstring-email-int-size)
- [Twig Extensions](#twig-extensions)
    - [AutolinkExtension](#autolinkextension)
        - [`autolink`](#autolink)
    - [AvatarExtension](#avatarextension)
        - [`avatar`](#avatar)
    - [IconExtension](#iconextension)
        - [`icon`](#icon)
    - [MarkdownExtension](#markdownextension)
        - [`markdown`](#markdown)
    - [TemplateExtension](#templateextension)
        - [`template_function_exist`](#template_function_exist)
        - [`template_function_call`](#template_function_call)
    - [DateTimeExtension](#datetimeextension)
        - [`to_datetime`](#to_datetime)
        - [`localdate`](#localdate)
        - [`localdatetime`](#localdatetime)
        - [`relativetime`](#relativetime)
        - [`timediff`](#timediff)
- [Twig Tags](#twig-tags)
    - [`frame`](#frame)
        - [Usage](#usage)
        - [Example](#example)
    - [`expand`](#expand)
        - [Usage](#usage-1)
        - [Example](#example-1)
- [JavaScript Libraries](#javascript-libraries)
    - [Datepicker](#datepicker)
    - [Choices](#choices)
    - [Taginput](#taginput)

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

[](#installation)

```
composer require t3g/symfony-template-bundle
```

Ensure that symfony default scripts are present in your `composer.json` file.

```
{
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    }
}
```

Configuration
=============

[](#configuration)

The bundle comes with a sensible default configuration, which is listed below. You can define these options if you need to change them:

```
# config/packages/template.yaml
template:
    application:
        # Example: Intercept
        name: 'Template Bundle'
        # Example: intercept
        platformkey: ~
        copyright:
            author: TYPO3 GmbH
            url: https://typo3.com
        routes:
             # Example: app_index
            home: app_index
            privacy: https://typo3.com/privacy-policy
            legal: https://typo3.com/legal-notice
            feedback: https://support.typo3.com
        menu:
            # Example: App\Menu\MenuBuilder
            class: T3G\Bundle\TemplateBundle\Menu\MenuBuilder
        assets:
            # Example: app
            encore_entrypoint: ~
        email:
            legal_footer: |
                TYPO3 GmbH, Emanuel-Leutze-Straße 11, DE-40547 Düsseldorf, Germany
                Phone: +49 (0)211 20 54 36 0, Web: www.typo3.com, Email: info@typo3.com

                Court of registration: Amtsgericht Düsseldorf HRB 77950
                CEO: Daniel Fau,  (CTO & Procuration) Frank Nägler
                Supervisory Board: Olivier Dobberkau, Ric van Westhreenen, Stefan Busemann
        theme:
            # Example: md
            navbar_breakpoint: lg
            use_logo: false
            background: light
```

```
bin/console config:dump-reference template
```

Configuration will be available within the templates and can be accessed through `template` variable.

Examples:

```
{% block title %}{% endblock %} - {{ template.application.name }}
```

```

    {{ template.application.name }}

```

Encore
------

[](#encore)

```
composer require symfony/webpack-encore-bundle
```

To enable your encore entrypoint simply configure the key within the yaml configuration.

```
# config/packages/template.yaml
template:
    application:
        assets:
            encore_entrypoint: app
```

Extending Menus
---------------

[](#extending-menus)

```
# config/packages/template.yml
template:
    application:
        menu:
            class: App\Menu\MenuBuilder
```

```
