PHPackages                             heimrichhannot/contao-youtube-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. [Image &amp; Media](/categories/media)
4. /
5. heimrichhannot/contao-youtube-bundle

Abandoned → [https://github.com/heimrichhannot/contao-video-bundle](/?search=https%3A%2F%2Fgithub.com%2Fheimrichhannot%2Fcontao-video-bundle)Contao-bundle[Image &amp; Media](/categories/media)

heimrichhannot/contao-youtube-bundle
====================================

Youtube Content Element, with responsive support, preview image, play button and many more.

3.10.4(1y ago)32.8k↑1400%LGPL-3.0-or-laterPHPPHP ^7.4 || ^8.0CI failing

Since Jun 6Pushed 1y ago5 watchersCompare

[ Source](https://github.com/heimrichhannot/contao-youtube-bundle)[ Packagist](https://packagist.org/packages/heimrichhannot/contao-youtube-bundle)[ RSS](/packages/heimrichhannot-contao-youtube-bundle/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (15)Versions (72)Used By (0)

YouTube
=======

[](#youtube)

[![](https://camo.githubusercontent.com/ebed4fccf49a75a01c07c2c176d4adc1d23f530c8eb050c092dedb36f2af18e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6865696d7269636868616e6e6f742f636f6e74616f2d796f75747562652d62756e646c652e737667)](https://packagist.org/packages/heimrichhannot/contao-youtube-bundle)[![](https://camo.githubusercontent.com/b0285cd1cfaea76b234c8f0f49f073458396a0dfe8b3e828bde90890bfd00aa3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6865696d7269636868616e6e6f742f636f6e74616f2d796f75747562652d62756e646c652e737667)](https://packagist.org/packages/heimrichhannot/contao-youtube-bundle)[![Build Status](https://camo.githubusercontent.com/67b845dba03763f4d0761d1b36e9f1220c3b5890698a93145256afa5a92c8de4/68747470733a2f2f7472617669732d63692e6f72672f6865696d7269636868616e6e6f742f636f6e74616f2d796f75747562652d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/heimrichhannot/contao-youtube-bundle)[![Coverage Status](https://camo.githubusercontent.com/f7412d4722c8ec2680fb12f2c93313fc10db9765aaae36795cee93ede55e2feb/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6865696d7269636868616e6e6f742f636f6e74616f2d796f75747562652d62756e646c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/heimrichhannot/contao-youtube-bundle?branch=master)

> YouTube-Bundle is not actively maintained anymore, as we developed a successor bundle: [Video Bundle](https://github.com/heimrichhannot/contao-video-bundle).

YouTube bundle aims responsive youtube videos with preview images and better privacy control. It provides support for content elements and news items.

**An valid [Youtube Data API Key](https://developers.google.com/youtube/v3/getting-started) is required for automatic preview image support (enter on in contao system settings or on your root page).**

> If you upgrade from heimrichhannot/contao-youtube, see the [upgrade notices](#upgrade-notice-from-heimrichhannotcontao-youtube).

Features
--------

[](#features)

- Responsive youtube videos
- Preview image for youtube videos
    - If no custom image is given, the preview image will be loaded from youtube and saved under 'files/media/youtube/'
- ConfigElements for [List-](https://github.com/heimrichhannot/contao-list-bundle) and [Readerbundle](https://github.com/heimrichhannot/contao-reader-bundle).
- [Encore Bundle](https://github.com/heimrichhannot/contao-encore-bundle) support
- Privacy mode
    - In privacy mode the video is displayed, after the user accepted a privacy advice within a modal prompt
    - The user can mark his selection as permanent with a checkbox (state will be saved in a cookie)

[![alt privacy modal](./docs/img/privacy_modal.jpg)](./docs/img/privacy_modal.jpg)

Technical instruction
---------------------

[](#technical-instruction)

### Add to list and reader item templates

[](#add-to-list-and-reader-item-templates)

For usage with [List-](https://github.com/heimrichhannot/contao-list-bundle) and [Readerbundle](https://github.com/heimrichhannot/contao-reader-bundle) you first need to add the config elements in List- and/or Reader config.

Afterwards you can add youtube to your template. The config elements add a formatted value `youtubeVideos` containing an array for each youtube field add by an config element.

```
$templateData = [
    // ...
    'youtubeVideos' => [
        'youtubeField' => [ // The selected youtube field name from config element
            'video' => '' // Generated default template,
            'data' => [] // Video data for custom templates
        ]
    ]
]
```

Example custom template:

```
{% if raw.addYouTube == "1" and youtubeVideos.youtube|default%}
    {% include '@VendorMyBundle/youtube/youtube_video_custom.html.twig' with youtubeVideos.youtube.data %}
{% endif %}
```

### News template

[](#news-template)

Youtube videos can be added to news templates with ease. Just add the following code (for example: news\_full.html5):

```

```

### Preview images from YouTube

[](#preview-images-from-youtube)

To use preview images from youtube, you have to generate an API key () and place it in the contao settings.

### Commands

[](#commands)

#### Migration Command

[](#migration-command)

```
Usage:
  huh:youtube:migration [options]

Options:
      --dry-run              Performs a run without writing to database.
      --migration=MIGRATION  Do migration directly without interrupt. Options: module, database, both, none
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -e, --env=ENV              The Environment name. [default: "prod"]
      --no-debug             Switches off debug mode.
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  This command provide migration scripts to migrate from heimrichhannot/contao-youtube to heimrichhannot/contao-youtube-bundle.

  Available migrations:
    'module' updates default template names and field values
    'database' updates database fields that can't be updated by the contao install tool.
    'both' will run 'module' and 'database' migrations.

```

Developers
----------

[](#developers)

### Events

[](#events)

EventEvent IDEvent to interact with AlertifyJs 'onshow' event`huh.youtube.event.alertify.onshow`Event to interact with AlertifyJs 'onfocus' event`huh.youtube.event.alertify.onfocus`Upgrade notice from heimrichhannot/contao-youtube
-------------------------------------------------

[](#upgrade-notice-from-heimrichhannotcontao-youtube)

- Use `huh:youtube:migration` command to migrated the default template settings in root pages and relatedYoutubeNews database field
- Declare an Youtube-API Key in tl\_settings or tl\_page (otherwise preview image download wont work)
- The modal windows for privacy dialog or modalvideo require additional css, that is not delivered by the bundle. Markup fits [Bootstrap](http://getbootstrap.com/) modal window css, so you are well-advised to use the css from that framework.
- If you were using custom youtube `.html5` templates, migrate them to `.html.twig` templates, if you need help: check the default templates

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance45

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 78.6% 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

Every ~35 days

Recently: every ~215 days

Total

70

Last Release

431d ago

Major Versions

1.3.3 → 2.0.02018-08-22

2.1.1 → v3.x-dev2018-09-26

2.1.3 → 3.0.02018-12-19

PHP version history (2 changes)1.0.0PHP ^7.1

3.10.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/28ad3224d8727b622ebd229840eea6b9dbcb83eb0bd609e6ce65b614830ff538?d=identicon)[digitales@heimrich-hannot.de](/maintainers/digitales@heimrich-hannot.de)

---

Top Contributors

[![koertho](https://avatars.githubusercontent.com/u/12064642?v=4)](https://github.com/koertho "koertho (22 commits)")[![ericges](https://avatars.githubusercontent.com/u/25957923?v=4)](https://github.com/ericges "ericges (3 commits)")[![mirkogleibe](https://avatars.githubusercontent.com/u/850300?v=4)](https://github.com/mirkogleibe "mirkogleibe (2 commits)")[![K0NZ1](https://avatars.githubusercontent.com/u/16319351?v=4)](https://github.com/K0NZ1 "K0NZ1 (1 commits)")

---

Tags

videoyoutubecontentcontaoresponsive

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/heimrichhannot-contao-youtube-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/heimrichhannot-contao-youtube-bundle/health.svg)](https://phpackages.com/packages/heimrichhannot-contao-youtube-bundle)
```

###  Alternatives

[terminal42/contao-node

Node bundle for Contao Open Source CMS

3172.5k4](/packages/terminal42-contao-node)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[chojnicki/video-platforms-parser

Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.

22226.4k](/packages/chojnicki-video-platforms-parser)[terminal42/contao-pageimage

\[Contao CMS\] Assign images to pages and output them on layout level using a frontend module.

1358.8k2](/packages/terminal42-contao-pageimage)

PHPackages © 2026

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