nowo-tech / marketing-kit-bundle
Symfony bundle to install and configure marketing tools (GTM, GA4, Meta Pixel, LinkedIn, TikTok, Hotjar, Clarity, custom) via YAML and/or Doctrine, with CookieConsent-compatible gating.
Package info
github.com/nowo-tech/MarketingKitBundle
Type:symfony-bundle
pkg:composer/nowo-tech/marketing-kit-bundle
Requires
- php: >=8.2 <8.6
- doctrine/doctrine-bundle: ^2.10 || ^3.0
- doctrine/orm: ^2.15 || ^3.0
- symfony/config: ^7.4 || ^8.0
- symfony/dependency-injection: ^7.4 || ^8.0
- symfony/form: ^7.4 || ^8.0
- symfony/framework-bundle: ^7.4 || ^8.0
- symfony/http-foundation: ^7.4 || ^8.0
- symfony/http-kernel: ^7.4 || ^8.0
- symfony/routing: ^7.4 || ^8.0
- symfony/security-csrf: ^7.4|^8.0
- symfony/translation: ^7.4|^8.0
- symfony/twig-bundle: ^7.4 || ^8.0
- symfony/yaml: ^7.4 || ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- nowo-tech/phpstan-frankenphp: ^1.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-symfony: ^2.0
- phpunit/phpunit: ^11.0
- rector/rector: ^2.0
- symfony/browser-kit: ^7.4 || ^8.0
- symfony/phpunit-bridge: ^7.4 || ^8.0
Suggests
- nowo-tech/cookie-consent-bundle: Gate marketing/analytics scripts with GDPR category cookies (Cookie_Category_*).
- symfony/flex: For automatic recipe installation (config and bundles.php)
README
⭐ Found this useful? Give it a star on GitHub! It helps us maintain and improve the project.
Symfony marketing kit: install and configure GTM, GA4, Meta Pixel, LinkedIn Insight, TikTok Pixel, Hotjar, Microsoft Clarity, and custom snippets via YAML profiles and/or Doctrine, with CookieConsent-compatible category gating.
This bundle is FrankenPHP worker mode friendly.
Features
- ✅ Providers (v1) —
gtm,ga4,meta_pixel,linkedin,tiktok,hotjar,clarity,custom - ✅ YAML profiles —
default_profile+profiles(REQ-CFG-001) - ✅ Database override —
use_database_config: truereplaces YAML tools when DB rows exist for the profile - ✅ Twig helpers —
nowo_marketing_head(),nowo_marketing_body_start(),nowo_marketing_body_end() - ✅ CookieConsent-compatible — reads
Cookie_Category_{analytics|marketing}(soft dependency) - ✅ Admin CRUD —
/admin/marketingto configure services (seed catalog, import YAML, toggle, typed option fields)
FrankenPHP: Demos use a single PHP service (FrankenPHP, no nginx). Runtime mode is controlled by FRANKENPHP_MODE in .env (worker default, or classic). The entrypoint selects Caddyfile (workers) or Caddyfile.dev (no workers) accordingly; see docs/DEMO-FRANKENPHP.md. Demo URL: http://localhost:8060 (see demo/README.md and .env.example).
Installation
composer require nowo-tech/marketing-kit-bundle
{# templates/base.html.twig #} <head> {{ nowo_marketing_head() }} </head> <body> {{ nowo_marketing_body_start() }} {% block body %}{% endblock %} {{ nowo_marketing_body_end() }} </body>
Optional GDPR gate (recommended):
composer require nowo-tech/cookie-consent-bundle
Quick configuration
# config/packages/nowo_marketing_kit.yaml nowo_marketing_kit: use_database_config: false respect_cookie_consent: true default_profile: default profiles: default: enabled: true tools: gtm: type: gtm enabled: true category: analytics position: head options: container_id: '%env(default::GTM_ID)%' gtm_noscript: type: gtm enabled: true category: analytics position: body_start options: container_id: '%env(default::GTM_ID)%' meta_pixel: type: meta_pixel enabled: false category: marketing position: head options: pixel_id: '%env(default::META_PIXEL_ID)%'
Import admin routes when using the database admin:
# config/routes/nowo_marketing_kit.yaml nowo_marketing_kit: resource: '@NowoMarketingKitBundle/Resources/config/routing.yaml'
Requirements
- PHP >= 8.2, < 8.6
- Symfony >= 7.4 || >= 8.0
- Doctrine ORM (for entities / optional DB config)
Documentation
- Installation
- Configuration
- Usage
- Contributing
- Code of Conduct
- Changelog
- Upgrading
- Release
- Security
- Engram
- Spec-driven development
- GitHub Spec Kit
Additional documentation
- GitHub Actions CI requirements
- Demo with FrankenPHP (includes worker mode)
- Server cookbook (Nginx, php-fpm, FrankenPHP)
Version information
| Version | PHP | Symfony | Status |
|---|---|---|---|
| 1.0.0 | >= 8.2, < 8.6 | 7.4 – 8.x | Stable |
Demos
make -C demo up-symfony8
# Demo started at: http://localhost:8060
Tests and coverage
| Language | Lines (approx.) | Command |
|---|---|---|
| PHP | 100% | make test-coverage |
| TypeScript | N/A | — |
| Python | N/A | — |
composer test
composer test-coverage
