Symfony2 Terrific Core Bundle
Pull request Compare This branch is 10 commits behind brunschgi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


The TerrificCore bundle makes it easy to develop frontends based on the Terrific Concept. It provides you a good starting point and useful features (eg. additional assetic filters) to streamline your frontend development.

The TerrificCore bundle has no dependencies but works best in combination with the TerrificComposerBundle. For installation of the TerrificComposerBundle, please follow the instructions there.


Register the namespace in app/autoload.php:

// app/autoload.php
    // ...
   'Terrific'         => __DIR__.'/../vendor/bundles',

Register the bundle in app/AppKernel.php:

// app/AppKernel.php
public function registerBundles()
    return array(
        // ...
        new Terrific\CoreBundle\TerrificCoreBundle(),

Enable the new terrificrewrite filter in app/config/config.yml:

# app/config/config_dev.yml
# extend assetic filter configuration (rewrite of the backround image path in your terrific modules)
            resource: %kernel.root_dir%/../vendor/bundles/Terrific/CoreBundle/Resources/config/terrificrewrite.xml

Enable the bundle's configuration in app/config/config_dev.yml:

# app/config/config_dev.yml
    copy_images: true # copy your module images on the fly without running `assets:install web`


To see the TerrificComposerCore in action, download the Terrific Composer Distribution and play around with the included examples. For more information about the Terrific Concept, please have a look at

After that, the below should be pretty straight forward ;-)

Base Layout

The base twig layout provides you everything you need to start with your Terrific project right away. Simple extend the base layout from your project layout:

{# eg. src/Terrific/Composition/Resources/views/base.html.twig #}
{% extends 'TerrificCoreBundle::base.html.twig' %}

The core layout provides you with several twig blocks to extend or overwrite. The most important ones are:

    {# main content of your page #}
    {% block composition %}here comes the content of the <body> element…{% endblock %}

    {# content of the <title> element #}
    {% block title %}Terrific Composer{% endblock %}

    {# placeholder for your meta tags (charset is always set to utf-8) #}
    {% block meta %}here comes your meta tags…{% endblock %}

    {# styles #}
    {% block styles %}
        {% stylesheets
            <link rel="stylesheet" href="{{ asset_url }}" />
        {% endstylesheets %}

        {# styles from parent (terrific core) layout #}
        {{ parent() }}
    {% endblock %}

    {# scripts #}
    {% block scripts %}
        {% javascripts
            <script src="{{ asset_url }}" type="text/javascript"></script>
        {% endjavascripts %}
    {% endblock %}

For a full list of available blocks, please have a look at @TerrificCoreBundle::base.html.twig.

Module Macro

Every Terrific Module is a separate bundle. The module macro makes it easy to mix and match them on your page. It works similar as the built-in twig helpers include and render and wraps your included / embedded module templates in the appropriate module <div>, eg. <div class="mod mod-news" data-connectors="update">... your template ...</div>.

Including Module Templates

{# wrap & include the view template /src/Terrific/Module/Teaser/Resources/views/default.html.twig #}
{{ tc.module('Teaser', 'default') }}

{# wrap & include the view template /src/Terrific/Module/Teaser/Resources/views/Concept/reusability.html.twig #}
{{ tc.module('Teaser', 'Concept/reusability') }}

Embedding Module Controller

If you are building not just templates but real applications with Terrific, it might be useful to delegate all the data stuff to the module itself so that you don't have to repeat yourself.

{# wrap & embed the module controller /src/Terrific/Module/Navigation/Controller/NavigationController.php -> mainAction #}
{{ tc.module('Navigation', 'Navigation:main') }}

The module macro can take some more parameters than just the module name and the view.

{% macro module(name, view, skins, connectors, attrs, data) %}

For more detailed infos, please have a look at Twig/Extension/terrificcore.html.twig.

That's it… Enjoy!