PHPackages                             viget/craft-video-embed - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. viget/craft-video-embed

ActiveCraft-plugin[Utility &amp; Helpers](/categories/utility)

viget/craft-video-embed
=======================

Generate an embed URL from a YouTube or Vimeo URL

3.2.0(1mo ago)2468.2k↓61.2%4[15 issues](https://github.com/vigetlabs/craft-videoembed/issues)MITPHPPHP ^8.2.0CI passing

Since Sep 13Pushed 1mo ago25 watchersCompare

[ Source](https://github.com/vigetlabs/craft-videoembed)[ Packagist](https://packagist.org/packages/viget/craft-video-embed)[ RSS](/packages/viget-craft-video-embed/feed)WikiDiscussions v3 Synced 2w ago

READMEChangelog (7)Dependencies (8)Versions (25)Used By (0)

Video Embed plugin for Craft CMS 5.x
====================================

[](#video-embed-plugin-for-craft-cms-5x)

Generate an embed URL from a YouTube or Vimeo URL.

Design philosophy
-----------------

[](#design-philosophy)

This plugin is intentionally **offline**: it derives everything it returns from the URL string alone. It makes **no external API or oEmbed calls** and requires **no caching layer**, so it adds no network latency, credentials, or runtime configuration to your site.

A practical consequence is that some metadata simply isn't available without a remote lookup, and the plugin returns `null` rather than fetching it:

- **Vimeo thumbnails** (`image`) — a Vimeo thumbnail URL can't be derived from the video ID, so `image` is `null` for Vimeo. YouTube thumbnails work because their URL is derivable from the ID.
- **Video orientation** (portrait vs. landscape) for Vimeo, for the same reason.

If you need that data, fetch (and cache) it in your application; that responsibility lives outside this plugin by design.

Requirements
------------

[](#requirements)

This plugin requires Craft CMS 5.0.0 or later.

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

[](#installation)

To install the plugin, follow these instructions.

1. Open your terminal and go to your Craft project:

    ```
     cd /path/to/project

    ```
2. Then tell Composer to load the plugin:

    ```
     composer require viget/craft-video-embed

    ```
3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Video Embed.

Using Video Embed
-----------------

[](#using-video-embed)

Pass a YouTube or Vimeo URL to the `getVideoData` method and a `VideoData` object is returned.

If the plugin is unable to parse the URL, `null` is returned.

- `type` - If the video is `youtube` or `vimeo`
- `id` - The ID of the video
- `image` - The thumbnail of the video (YouTube only; `null` for Vimeo — see [Design philosophy](#design-philosophy))
- `embedUrl` - The URL you would use for the embed
- `url` - The link to the embedded video
- `isVertical` - `true` for YouTube Shorts (vertical/portrait) videos, otherwise `false`. Detected from the `/shorts/` URL form, not the video's true orientation.

**Example:**

```
{% set video = craft.videoEmbed.getVideoData('https://www.youtube.com/watch?v=6xWpo5Dn254') %}

{% if video %}

{% endif %}
```

**Output:**

```

```

YouTube embed URLs include `rel=0` so related-video suggestions stay on the same channel rather than promoting unrelated videos.

### Customizing URL params

[](#customizing-url-params)

Because `embedUrl` already carries a query string (YouTube's `rel=0`, or a Vimeo privacy `h` hash), add your own player params with Craft's built-in [`url()`](https://craftcms.com/docs/5.x/reference/twig/functions.html#url) function rather than concatenating onto `embedUrl`. `url()` preserves the existing params and merges in your own:

```

{# → https://www.youtube.com/embed/6xWpo5Dn254?rel=0&autoplay=1&mute=1 #}
```

---

[ ![Code At Viget](https://camo.githubusercontent.com/93b8927421fe8b33578eb274ce1d4b71954df6f83e2b0e51c28d92e8ac64d6ac/687474703a2f2f636f64652e76696765742e636f6d2f6769746875622d62616e6e65722e706e67)](http://code.viget.com)Visit [code.viget.com](http://code.viget.com) to see more projects from [Viget.](https://viget.com)

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance80

Actively maintained with recent releases

Popularity40

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 55.9% 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 ~248 days

Recently: every ~15 days

Total

14

Last Release

39d ago

Major Versions

1.2.2 → 2.0.02022-09-07

2.0.3 → 3.0.02025-02-04

v2.x-dev → 3.1.02026-06-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/9728af4299f2de6d5f099f957bf6f4c8b312076b104910f8d4d8afc39540b686?d=identicon)[viget](/maintainers/viget)

---

Top Contributors

[![joshuapease](https://avatars.githubusercontent.com/u/2145998?v=4)](https://github.com/joshuapease "joshuapease (19 commits)")[![davist11](https://avatars.githubusercontent.com/u/199985?v=4)](https://github.com/davist11 "davist11 (5 commits)")[![maxfenton](https://avatars.githubusercontent.com/u/906502?v=4)](https://github.com/maxfenton "maxfenton (5 commits)")[![ten1seven](https://avatars.githubusercontent.com/u/137020?v=4)](https://github.com/ten1seven "ten1seven (4 commits)")[![ThomasDeMarez](https://avatars.githubusercontent.com/u/10974106?v=4)](https://github.com/ThomasDeMarez "ThomasDeMarez (1 commits)")

---

Tags

craft-plugincraft5craftcmscmsCraftcraftcmscraft-pluginvideo-embed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/viget-craft-video-embed/health.svg)

```
[![Health](https://phpackages.com/badges/viget-craft-video-embed/health.svg)](https://phpackages.com/packages/viget-craft-video-embed)
```

###  Alternatives

[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k78](/packages/verbb-formie)[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.5M73](/packages/nystudio107-craft-seomatic)[verbb/hyper

A user-friendly links field for Craft.

24153.5k14](/packages/verbb-hyper)[verbb/vizy

A flexible visual editor field for Craft.

4251.5k1](/packages/verbb-vizy)[verbb/comments

Add comments to your site.

13754.0k1](/packages/verbb-comments)[verbb/navigation

Create navigation menus for your site.

90711.5k20](/packages/verbb-navigation)

PHPackages © 2026

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