PHPackages                             tc/twig-global-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. tc/twig-global-bundle

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

tc/twig-global-bundle
=====================

TcTwigGlobalBundle

v1.0.0(11y ago)017MITPHPPHP &gt;=5.3.2

Since May 7Pushed 11y ago3 watchersCompare

[ Source](https://github.com/ThreeceeStudios/TcTwigGlobalBundle)[ Packagist](https://packagist.org/packages/tc/twig-global-bundle)[ Docs](https://github.com/ThreeceeStudios/TcTwigGlobalBundle)[ RSS](/packages/tc-twig-global-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Tc Twig Global Bundle
=====================

[](#tc-twig-global-bundle)

[![Latest Stable Version](https://camo.githubusercontent.com/b769ac087c46417f313973a4ec9d0675cd0c628a5c5458c5c011332d1f84c83d/68747470733a2f2f706f7365722e707567782e6f72672f74632f747769672d676c6f62616c2d62756e646c652f762f737461626c65)](https://packagist.org/packages/tc/twig-global-bundle)

[![SensioLabsInsight](https://camo.githubusercontent.com/d89347e0d81a9f168dc231c8be5e46f79806c680824f3f1e6666139a70f499e7/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61313636346130642d376631332d343961652d383038352d6566383366336534626166382f6269672e706e67)](https://insight.sensiolabs.com/projects/a1664a0d-7f13-49ae-8085-ef83f3e4baf8)

Provides some useful twig tags for global variables.

Installation
------------

[](#installation)

```
composer require tc/twig-global-bundle

```

Enable the bundle in your `AppKernel.php`

```
$bundles = array(
    // ...

    new Tc\Bundle\TwigGlobal\TcTwigGlobalBundle(),

    // ...
);
```

Usage
-----

[](#usage)

Usage in Twig:

```
{# set a global #}
{% global title = 'My Title' %}

{# get a global #}
{% global title %}

{# merging #}
{% global title ~ ' | My Title Suffix' %}

{# set defaults #}
{% global title 'My Title' default %}
{# this can be overwritten in a child template #}
{% global title 'My Other Title' %}

{# working with arrays #}
{% global colors = ['red', 'green', 'blue'] %}
{% global colors ~ 'purple' %} {# red, green, blue, purple #}
{% global colors ~ ['red', 'blue', 'yellow'] unique %} {# red, green, blue, purple, yellow #}

{# access globals outside of tag #}
{{ _tc_global.get('title', 'some default value') }}
{{ _tc_global.set('title', 'value', true /* default */) }}
{{ _tc_global.merge('colors', 'purple', false /* default */, false /* unique */) }}
```

Usage in PHP via the `tc.twig_global` service:

```
$container->get('tc.twig_global')->set('title', 'something');
$container->get('tc.twig_global')->get('title');
$container->get('tc.twig_global')->merge('colors', 'blue');
// etc
```

License
-------

[](#license)

TcTwigGlobalBundle is licensed with the MIT license.

See LICENSE for more details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4029d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2d6816fd5e3bcf30fd6cf5cacd03518594c9651ba132248c99ef852dd613426?d=identicon)[carlcraig](/maintainers/carlcraig)

---

Top Contributors

[![carlcraig](https://avatars.githubusercontent.com/u/919781?v=4)](https://github.com/carlcraig "carlcraig (6 commits)")

---

Tags

twig

### Embed Badge

![Health badge](/badges/tc-twig-global-bundle/health.svg)

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

###  Alternatives

[twig/extra-bundle

A Symfony bundle for extra Twig extensions

91492.0M315](/packages/twig-extra-bundle)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)[yellowskies/qr-code-bundle

Symfony Barcode &amp; QR Code Generator Bundle with Twig extension

36682.9k](/packages/yellowskies-qr-code-bundle)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

1432.0k](/packages/symfony-ux-toolkit)[boekkooi/jquery-validation-bundle

Jquery form validation bundle for symfony 2

2773.9k1](/packages/boekkooi-jquery-validation-bundle)[zenstruck/twig-service-bundle

Make functions, static methods, Symfony service methods available in your twig templates.

1310.1k](/packages/zenstruck-twig-service-bundle)

PHPackages © 2026

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