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

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ivopetkov/video-embed
=====================

Video embed library

v0.4.6(5mo ago)58.9k↓100%4[1 PRs](https://github.com/ivopetkov/video-embed/pulls)1MITPHPPHP 8.0.\*|8.1.\*|8.2.\*|8.3.\*|8.4.\*|8.5.\*

Since Apr 25Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/ivopetkov/video-embed)[ Packagist](https://packagist.org/packages/ivopetkov/video-embed)[ Fund](https://www.paypal.me/ivopetkovcom)[ GitHub Sponsors](https://github.com/ivopetkov)[ RSS](/packages/ivopetkov-video-embed/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)DependenciesVersions (18)Used By (1)

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

[](#video-embed)

Simple library that returns embed information for a given video url.

Supported video services: Dailymotion, Facebook, Flickr, Hulu, Kickstarter, The New York Times, Ted, Vimeo, Vine, YouTube.

[![Build Status](https://camo.githubusercontent.com/27a53df3ecb850ad21fd3a23b65e0906a64eb6bafb3d586c4996fb8590731168/68747470733a2f2f7472617669732d63692e6f72672f69766f7065746b6f762f766964656f2d656d6265642e737667)](https://travis-ci.org/ivopetkov/video-embed)[![Latest Stable Version](https://camo.githubusercontent.com/bf5c906e703aef6a96c9947b13ced16195f22d1d0097bea6058fe3eb5cd1b7ef/68747470733a2f2f706f7365722e707567782e6f72672f69766f7065746b6f762f766964656f2d656d6265642f762f737461626c65)](https://packagist.org/packages/ivopetkov/video-embed)[![codecov.io](https://camo.githubusercontent.com/ee262c836b7a21318ce801f702b2e3ba88639db52d5a2db75fd3b5541c450031/68747470733a2f2f636f6465636f762e696f2f6769746875622f69766f7065746b6f762f766964656f2d656d6265642f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/ivopetkov/video-embed?branch=master)[![License](https://camo.githubusercontent.com/1f4fef0b1866013a090f657dc113864a0e52a7c585d64a942afcfc9680927af9/68747470733a2f2f706f7365722e707567782e6f72672f69766f7065746b6f762f766964656f2d656d6265642f6c6963656e7365)](https://packagist.org/packages/ivopetkov/video-embed)[![Codacy Badge](https://camo.githubusercontent.com/5f2acb889d1c192bdfd3af435cbebe7f464c6c4d2fc0160466992d75e60b9aaf/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3563366534623939653362343434303639326435383835633231373330653861)](https://www.codacy.com/app/ivo_2/video-embed)

Download and install
--------------------

[](#download-and-install)

- Install via Composer

```
composer require ivopetkov/video-embed

```

- Download the zip file

Download the [latest release](https://github.com/ivopetkov/video-embed/releases) from our GitHub page, unzip and include the `autoload.php` file.

Usage
-----

[](#usage)

```
$videoEmbed = new IvoPetkov\VideoEmbed('https://www.youtube.com/watch?v=Pwe-pA6TaZk');

// IvoPetkov\VideoEmbed Object
// (
//     [url] => https://www.youtube.com/watch?v=Pwe-pA6TaZk
//     [html] =>
//     [width] => 480
//     [height] => 270
//     [duration] =>
//     [title] => Where the Hell is Matt? 2012
//     [description] =>
//     [thumbnail] => Array
//         (
//             [url] => https://i.ytimg.com/vi/Pwe-pA6TaZk/hqdefault.jpg
//             [width] => 480
//             [height] => 360
//         )
//     [author] => Array
//         (
//             [name] => Matt Harding
//             [url] => https://www.youtube.com/user/mattharding2718
//         )
//     [provider] => Array
//         (
//             [name] => YouTube
//             [url] => https://www.youtube.com/
//         )
//     [rawResponse] => {"html": "\u003ciframe width=\"480\" height=\"270\" ...
// )

$videoEmbed->setSize(800, 600); // will set a new width and height in the video html code

```

Documentation
-------------

[](#documentation)

### Classes

[](#classes)

#### IvoPetkov\\VideoEmbed

[](#ivopetkovvideoembed)

##### Constants

[](#constants)

`const string VERSION`

##### Properties

[](#properties)

`public string $url`

 The video url

`public string $html`

 The video html code

`public string|int $width`

 The video width

`public string|int $height`

 The video height

`public int $duration`

 The video duration

`public string $title`

 The video title

`public string $description`

 The video description

`public array $thumbnail`

 An array containing an url and sizes for the video thumbnail image

`public array $author`

 An array containing the name and the url of the author

`public array $provider`

 An array containing the name and the url of the provider

`public string $rawResponse`

 The raw response from the provider embed endpoint

##### Methods

[](#methods)

```
public __construct ( [ string $url ] )

```

Creates a new VideoEmbed object and load it if an url is specified

*Parameters*

 `$url`

 The video url

*Returns*

 No value is returned.

```
public void load ( string $url )

```

Loads the data for the url specified

*Parameters*

 `$url`

 The video url

*Returns*

 No value is returned

```
public void setSize ( string|int $width , string|int $height )

```

Sets new width and height in the video html code

*Parameters*

 `$width`

 Thew new width

 `$height`

 Thew new height

*Returns*

 No value is returned

License
-------

[](#license)

Video Embed is open-sourced software. It's free to use under the MIT license. See the [license file](https://github.com/ivopetkov/video-embed/blob/master/LICENSE) for more information.

Author
------

[](#author)

This library is created by Ivo Petkov. Feel free to contact me at [@IvoPetkovCom](https://twitter.com/IvoPetkovCom) or [ivopetkov.com](https://ivopetkov.com).

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance72

Regular maintenance activity

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity79

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 ~219 days

Recently: every ~296 days

Total

17

Last Release

155d ago

PHP version history (6 changes)v0.0.1PHP &gt;=5.5.0

v0.2.0PHP &gt;=7.0.0

v0.4.1PHP 7.1.\*|7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*

v0.4.3PHP 7.1.\*|7.2.\*|7.3.\*|7.4.\*|8.0.\*|8.1.\*|8.2.\*|8.3.\*

v0.4.5PHP 8.0.\*|8.1.\*|8.2.\*|8.3.\*|8.4.\*

v0.4.6PHP 8.0.\*|8.1.\*|8.2.\*|8.3.\*|8.4.\*|8.5.\*

### Community

Maintainers

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

---

Top Contributors

[![ivopetkov](https://avatars.githubusercontent.com/u/13205385?v=4)](https://github.com/ivopetkov "ivopetkov (53 commits)")

### Embed Badge

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

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

###  Alternatives

[shaozeming/aliyun-sts

基于阿里云openapi系列接口中STS最新版本的SDK进行封装的composer package

2021.0k1](/packages/shaozeming-aliyun-sts)

PHPackages © 2026

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