PHPackages                             justijndepover/embed-video - 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. justijndepover/embed-video

ActiveLibrary[Image &amp; Media](/categories/media)

justijndepover/embed-video
==========================

Extract the embed url from Youtube and Vimeo videos

1.0.6(1y ago)21.2k↓66.7%1[1 issues](https://github.com/justijndepover/embed-video/issues)MITPHPCI passing

Since Nov 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/justijndepover/embed-video)[ Packagist](https://packagist.org/packages/justijndepover/embed-video)[ Docs](https://github.com/justijndepover/embed-video)[ RSS](/packages/justijndepover-embed-video/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (0)

Embed Video
===========

[](#embed-video)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f63cd68b1819a7eaa4194e8a5e35937961d394b6d21bed5867661fea7941e961/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a757374696a6e6465706f7665722f656d6265642d766964656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/justijndepover/embed-video)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/401b6e61e689e5a48a315340b292c281b451b58abf4ea3118b392b357ddc7149/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6a757374696a6e6465706f7665722f656d6265642d766964656f2f54657374733f7374796c653d666c61742d737175617265)](https://github.com/justijndepover/embed-video/actions)[![Total Downloads](https://camo.githubusercontent.com/c4c256ba19bbec18d14b2560e47b4cb3b14027ae271e0eb38916de38d73e7858/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a757374696a6e6465706f7665722f656d6265642d766964656f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/justijndepover/embed-video)

This package makes it easier to work with both Youtube and Vimeo video url's. It automatically detects the reference from the url.

For example:

```
https://www.youtube.com/watch?v=dQw4w9WgXcQ
https://youtu.be/dQw4w9WgXcQ
https://www.youtube.com/embed/dQw4w9WgXcQ

```

are all valid youtube links, but to embed an iFrame, you need the third option.

This package allows all the options as input, and is able to generate the correct output urls to embed the iframe.

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

[](#installation)

You can install the package with composer

```
composer require justijndepover/embed-video
```

Usage
-----

[](#usage)

```
use Justijndepover\EmbedVideo\Video;

$video = Video::from('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
```

If you provide the class with a faulty link, a `Justijndepover\EmbedVideo\VideoException` will be thrown.

### Validate

[](#validate)

```
$validated = Video::validate('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
```

This will validate the given url and return either `true` or `false`

### Embed

[](#embed)

```
$html = $video->embed();
```

This will generate the embedded iframe for either Youtube or Vimeo.

```

```

### Embed url

[](#embed-url)

```
$url = $video->embedUrl();
```

This will generate the embedded url used in the iframe for either Youtube or Vimeo.

```
https://www.youtube.com/embed/dQw4w9WgXcQ

```

### Thumbnail

[](#thumbnail)

```
$thumbnail = $video->thumbnail();
```

This will generate a thumbnail url for the cover image;

```
http://img.youtube.com/vi/dQw4w9WgXcQ/0.jpg

```

### Reference

[](#reference)

```
$reference = $video->reference();
```

This will return the video reference;

```
dQw4w9WgXcQ

```

### Mute

[](#mute)

To add mute to the embed iframe, you can make use of the fluent syntax:

```
$html = $video->muted()->embed();
```

```

```

### Autoplay

[](#autoplay)

To add autoplay to the embed iframe, you can make use of the fluent syntax:

```
$html = $video->autoplay()->embed();
```

```

```

note: adding autoplay will automatically mute the video.

### Class

[](#class)

To add a class to the embed iframe, you can make use of the fluent syntax:

```
$html = $video->class('video-container')->embed();
```

```

```

### Additional attributes

[](#additional-attributes)

To add additional attributes to the embed iframe, you can make use of the fluent syntax:

```
$html = $video->addAttribute('width', 'auto')->embed();
```

```

```

Security
--------

[](#security)

If you find any security related issues, please open an issue or contact me directly at [justijndepover@gmail.com](justijndepover@gmail.com).

Contribution
------------

[](#contribution)

If you wish to make any changes or improvements to the package, feel free to make a pull request.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~181 days

Recently: every ~359 days

Total

10

Last Release

383d ago

Major Versions

0.3.0 → 1.0.02020-12-09

### Community

Maintainers

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

---

Top Contributors

[![justijndepover](https://avatars.githubusercontent.com/u/9008623?v=4)](https://github.com/justijndepover "justijndepover (26 commits)")

---

Tags

phpvideovimeoyoutubephpvideoyoutubevimeoembedjustijndepover

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[dereuromark/media-embed

A PHP library to deal with all those media services around, parsing their URLs and embedding their audio/video content in websites.

182530.3k11](/packages/dereuromark-media-embed)[cohensive/oembed

Media embed generation using OEmbed protocol.

3567.1k](/packages/cohensive-oembed)[mediamonks/sonata-media-bundle

A powerful, flexible and easy to use alternative for the existing Sonata Media Bundle

109.8k](/packages/mediamonks-sonata-media-bundle)

PHPackages © 2026

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