PHPackages                             twig-component-tools/tct-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. twig-component-tools/tct-bundle

ActiveSymfony-bundle

twig-component-tools/tct-bundle
===============================

3144PHP

Since Apr 20Pushed 3y ago1 watchersCompare

[ Source](https://github.com/twig-component-tools/tct-bundle)[ Packagist](https://packagist.org/packages/twig-component-tools/tct-bundle)[ RSS](/packages/twig-component-tools-tct-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Twig Component Tools | Loader
=============================

[](#twig-component-tools--loader)

Component loader and pre-processor for Twig templates.

Project Status: ABANDONED
-------------------------

[](#project-status-abandoned)

> ![Warning](https://github.com/Mqxx/GitHub-Markdown/raw/main/blockquotes/badge/dark-theme/warning.svg)
> This was a shortcut taken to allow **junior/intermediate Vue.js developers** to quickly jump into **huge legacy Symfony/Twig templates**.
>
> Its only purpose was to **survive a big refactoring** middle-step, allowing us to **move forward with Vue.js** and other more suited frontend languages.
>
> If you still feel like this can help you, don't hesitate to contact  or create an issue.

Syntax
------

[](#syntax)

Components can be used within regular Twig templates:

```
{# File: @components/Page/PHome/PHome.twig #}
{% extends '@components/Teamplate/TBase.twig' %}

{% block contents %}

{% endblock %}
```

```
{# File: @components/Atom/AButton/AButton.twig #}

  {{ props.label }}

```

Properties
----------

[](#properties)

Props passed to your components can be either hard-coded strings (example: `theme`), or variables and expressions ( example: `level`). They will be scoped in the object `props`.

```

```

Blocks
------

[](#blocks)

Blocks can be defined and used like in any regular twig template. There are a few syntactic helpers, though:

### Default Blocks

[](#default-blocks)

```
{# File: @components/Page/PHome/PHome.twig #}
{% extends '@components/Teamplate/TBase.twig' %}

{% block contents %}

    {{ 'button.edit_entity'|trans }}

{% endblock %}
```

```
{# File: @components/Atom/AButton/AButton.twig #}

  {% block AButton__default %}{% endblock %}

```

### Named Blocks

[](#named-blocks)

```
{# File: @components/Page/PHome/PHome.twig #}
{% extends '@components/Teamplate/TBase.twig' %}

{% block contents %}

      &times;

    {{ 'button.edit_entity'|trans }}

{% endblock %}
```

```
{# File: @components/Atom/AButton/AButton.twig #}

  {% if block('icon') is defined %}
    {{ block('icon')|raw }}
  {% endif %}

    {% block label %}{% endblock %}

```

Inner workings
--------------

[](#inner-workings)

Since this component loader works as a pre-processor, it's goal is to accept subjectively easier/better syntax, and to pass valid Twig syntax to the Twig engine.

Understanding what is transpiled to what can help you master this new syntax:

- Include: Component without blocks
- Embed: Component with blocks
- String parameters: properties without `{{ … }}`
- Variables and expressions: properties with `{{ … }}`

### Examples

[](#examples)

TCT In:

```

      &times;

    {{ 'button.edit_entity'|trans }}

```

Twig Out (Simplified):

```
 {% embed '@components/Atom/AButton/AButton.twig' with { props: { theme: "primary" } } %}
    {% block icon %}
      &times;
    {% endblock %}

    {% block label %}
      {{ 'button.edit_entity'|trans }}
    {% endblock %}
 {% endembed %}

 {% include '@components/Atom/AIcon/AIcon.twig' with { props: { name: random_name() } } %}
```

### Reasoning

[](#reasoning)

This preprocessor aims to make developing and reviewing Twig templates easier and faster.

There is not enough visual distinction between **control**statements: `{% if … %}`, `{% for … %}`, `{% set … %}` and **markup/composition**: `{% include … %}`, `{% embed … %}`.

[Customizing the syntax](https://twig.symfony.com/doc/2.x/recipes.html#customizing-the-syntax) doesn't quite cut it for me.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/aee9ca164cbefb8114117b2111710d7e0d0d0b58e60588db57fcc05193b19ba4?d=identicon)[barthy.koeln](/maintainers/barthy.koeln)

---

Top Contributors

[![barthy-koeln](https://avatars.githubusercontent.com/u/10552683?v=4)](https://github.com/barthy-koeln "barthy-koeln (7 commits)")

### Embed Badge

![Health badge](/badges/twig-component-tools-tct-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/twig-component-tools-tct-bundle/health.svg)](https://phpackages.com/packages/twig-component-tools-tct-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
