PHPackages                             bensampo/laravel-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. bensampo/laravel-embed

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

bensampo/laravel-embed
======================

Painless responsive embeds for videos, slideshows and more.

v3.1.0(1mo ago)142146.8k↓10.4%21MITPHPPHP ^7.4.0|^8.0CI passing

Since Aug 24Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/BenSampo/laravel-embed)[ Packagist](https://packagist.org/packages/bensampo/laravel-embed)[ Docs](https://github.com/bensampo/laravel-embed)[ GitHub Sponsors](https://github.com/bensampo)[ RSS](/packages/bensampo-laravel-embed/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (12)Versions (17)Used By (0)

Laravel Embed
=============

[](#laravel-embed)

[![Laravel Embed](https://github.com/BenSampo/laravel-embed/raw/master/branding/github-open-graph-image.png?sanitize=true)](https://github.com/BenSampo/laravel-embed/raw/master/branding/github-open-graph-image.png?sanitize=true)

Effortless responsive embeds for videos, slideshows and more.
Created by [Ben Sampson](https://sampo.co.uk)

[![Packagist Stable Version](https://camo.githubusercontent.com/79b5a20419f42c9c31523f33fa33b02bfe404a61ae89d79ebb34e61aa910eea5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62656e73616d706f2f6c61726176656c2d656d6265642e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65)](https://packagist.org/packages/bensampo/laravel-embed)[![Packagist downloads](https://camo.githubusercontent.com/ddc4c8a0182aa904e738a3be8b09d9e829becc2f7333b58c3820879d555f01c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62656e73616d706f2f6c61726176656c2d656d6265642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/bensampo/laravel-embed)[![MIT Software License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

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

[](#requirements)

- Laravel `8` or newer
- PHP `7.4.0` or newer

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

[](#installation)

### 1. Composer

[](#1-composer)

```
composer require bensampo/laravel-embed
```

### 2. Include styles

[](#2-include-styles)

Somewhere inside the `` element of the document, include:

```

```

If you'd prefer to include the styles in your own CSS file, you may copy the contents of [`styles.blade.php`](https://github.com/BenSampo/laravel-embed/blob/master/resources/views/components/styles.blade.php).

### 3. Publish views (optional)

[](#3-publish-views-optional)

If you'd like to edit any of the views you may publish them:

```
php artisan vendor:publish --provider="BenSampo\Embed\EmbedServiceProvider"
```

Once published they can be found in `/resources/views/vendor/embed/`.

Usage
-----

[](#usage)

Simply include the following blade component in your view making sure to pass the `url` attribute.

The `url` should be the public URL for the page you're trying to embed.

```

```

### Setting the aspect ratio

[](#setting-the-aspect-ratio)

By default most embedded services are shown at a ratio of `16:9`. Some services may override this if they have a more appropriate default. However, you can always change this by passing in a ratio to the `aspect-ratio` attribute.

```

```

The aspect ratio is maintained at different viewport sizes.

### Fallback

[](#fallback)

If no service exists to handle the URL a fallback view is rendered. You can customize this by publishing the views and editing `/resources/views/vendor/embed/services/fallback.blade.php`.

### Validation

[](#validation)

A validation rule can be used to check for a supported service in a given URL.

```
use BenSampo\Embed\Rules\EmbeddableUrl;

public function store(Request $request)
{
    $this->validate($request, [
        'url' => ['required', new EmbeddableUrl],
    ]);
}
```

You may specify a list of allowed services using the `allowedServices` method.

```
use BenSampo\Embed\Services\Vimeo;
use BenSampo\Embed\Services\YouTube;
use BenSampo\Embed\Rules\EmbeddableUrl;

public function store(Request $request)
{
    $this->validate($request, [
        'url' => [
            'required',
            (new EmbeddableUrl)->allowedServices([
                YouTube::class,
                Vimeo::class
            ])
        ],
    ]);
}
```

Embed Services
--------------

[](#embed-services)

Laravel embed supports multiple popular embed services such as YouTube, Vimeo and Slideshare.

[See the full list →](https://github.com/BenSampo/laravel-embed/tree/master/src/Services)

Please submit an issue (or better yet a PR!) if the service you'd like to embed is not listed.

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance89

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 81% 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 ~136 days

Recently: every ~91 days

Total

16

Last Release

54d ago

Major Versions

v1.4.0 → v2.0.02023-02-20

v2.5.0 → v3.0.02025-03-26

PHP version history (2 changes)v1.0.0PHP ^7.4.0

v1.3.0PHP ^7.4.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/487559f7d72ea2a4a963dc9dc0764ac35a8583b05d0afec5322539510a4fe82e?d=identicon)[BenSampo](/maintainers/BenSampo)

---

Top Contributors

[![BenSampo](https://avatars.githubusercontent.com/u/1488068?v=4)](https://github.com/BenSampo "BenSampo (64 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![sdebacker](https://avatars.githubusercontent.com/u/134503?v=4)](https://github.com/sdebacker "sdebacker (3 commits)")[![cheesegrits](https://avatars.githubusercontent.com/u/934456?v=4)](https://github.com/cheesegrits "cheesegrits (2 commits)")[![roberttolton](https://avatars.githubusercontent.com/u/3510875?v=4)](https://github.com/roberttolton "roberttolton (1 commits)")[![satoved](https://avatars.githubusercontent.com/u/14319239?v=4)](https://github.com/satoved "satoved (1 commits)")[![adamcmoore](https://avatars.githubusercontent.com/u/5844678?v=4)](https://github.com/adamcmoore "adamcmoore (1 commits)")[![stefro](https://avatars.githubusercontent.com/u/5249559?v=4)](https://github.com/stefro "stefro (1 commits)")[![frasermurraysco](https://avatars.githubusercontent.com/u/7722146?v=4)](https://github.com/frasermurraysco "frasermurraysco (1 commits)")[![jamosmk7](https://avatars.githubusercontent.com/u/4723195?v=4)](https://github.com/jamosmk7 "jamosmk7 (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

embedlaravellaravel-packagevimeoyoutubelaravelpackageembedbensampo

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bensampo-laravel-embed/health.svg)

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

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[gallib/laravel-short-url

A Laravel package to shorten urls

16516.4k](/packages/gallib-laravel-short-url)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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