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(4mo ago)144194.6k↓43.3%21[1 issues](https://github.com/BenSampo/laravel-embed/issues)MITPHPPHP ^7.4.0|^8.0CI passing

Since Aug 24Pushed 4mo 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 2w 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

58

—

FairBetter than 98% of packages

Maintenance73

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity69

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

145d 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

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k113.1M997](/packages/laravel-socialite)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k26.0M804](/packages/laravel-boost)[nativephp/mobile

NativePHP for Mobile

1.1k102.1k146](/packages/nativephp-mobile)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M188](/packages/spatie-laravel-health)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

679153.2k7](/packages/spatie-laravel-export)

PHPackages © 2026

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