PHPackages                             setono/tag-bag-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. setono/tag-bag-bundle

ActiveSymfony-bundle

setono/tag-bag-bundle
=====================

A Symfony bundle that integrates the tag bag library into Symfony

v3.2.0(1y ago)4456.2k↓23.5%6[1 PRs](https://github.com/Setono/TagBagBundle/pulls)10MITPHPPHP &gt;=8.1

Since Jan 9Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Setono/TagBagBundle)[ Packagist](https://packagist.org/packages/setono/tag-bag-bundle)[ RSS](/packages/setono-tag-bag-bundle/feed)WikiDiscussions 3.x Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (33)Used By (10)

Symfony Tag Bag Bundle
======================

[](#symfony-tag-bag-bundle)

[![Latest Version](https://camo.githubusercontent.com/0411320b7ceec26409247456e47f3bb67f7cde9489ba20da78f4f9375ea2e5cb/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f7461672d6261672d62756e646c652f762f737461626c65)](https://packagist.org/packages/setono/tag-bag-bundle)[![Software License](https://camo.githubusercontent.com/9fe15ef53b96ccdc2fffc7130a5dcb60d0467626912303bd4a237a6e1c72cf22/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f7461672d6261672d62756e646c652f6c6963656e7365)](LICENSE)[![Build Status](https://github.com/Setono/TagBagBundle/workflows/build/badge.svg)](https://github.com/Setono/TagBagBundle/actions)

This bundle integrates the [tag bag library](https://github.com/Setono/tag-bag) and creates a service named `setono_tag_bag.tag_bag` which you can use to inject tags onto pages.

It is especially useful when you want to inject tags that are dynamic by nature. This could be ecommerce tracking, affiliate tracking etc.

It works by adding tags to the tag bag within the request cycle. When the request cycle is done, the remaining tags will be saved to the session. On a new page load, the tag bag will be restored. This is what makes it extremely versatile when you want to track events in your HTML, but the event is happening in a service/controller somewhere.

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

[](#installation)

### Step 1: Download

[](#step-1-download)

```
composer require setono/tag-bag-bundle
```

### Step 2: Enable the bundle

[](#step-2-enable-the-bundle)

If you use [Symfony Flex](https://flex.symfony.com/) it will be enabled automatically. Else you need to add it to the `config/bundles.php`:

```
