All Projects → BenSampo → laravel-embed

BenSampo / laravel-embed

Licence: MIT license
Effortless responsive embeds for videos, slideshows and more.

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to laravel-embed

oembed
PHP OEmbed wrapper for well-known video platforms and services
Stars: ✭ 26 (-75.47%)
Mutual labels:  vimeo, embed
php-video-url-parser
A Simple and efficient PHP Video URL Parser that provides you thumbnails and embed codes for various video streaming websites
Stars: ✭ 57 (-46.23%)
Mutual labels:  vimeo, embed
Vime
Customizable, extensible, accessible and framework agnostic media player. Modern alternative to Video.js and Plyr. Supports HTML5, HLS, Dash, YouTube, Vimeo, Dailymotion...
Stars: ✭ 1,928 (+1718.87%)
Mutual labels:  vimeo, embed
laracash
PHP Laravel Money Package 💰
Stars: ✭ 52 (-50.94%)
Mutual labels:  laravel-package
voyager-portfolio
A Portfolio Module for Laravel Voyager 💋
Stars: ✭ 15 (-85.85%)
Mutual labels:  laravel-package
lite-vimeo-embed
🎥 A faster Vimeo embed.
Stars: ✭ 107 (+0.94%)
Mutual labels:  vimeo
bread-templates
BREAD Templates with Voyager
Stars: ✭ 19 (-82.08%)
Mutual labels:  laravel-package
firebase-php
Firebase Realtime Database PHP Wrapper
Stars: ✭ 41 (-61.32%)
Mutual labels:  laravel-package
laravel-charts-css
Laravel component to create gorgeous Charts.css charts.
Stars: ✭ 105 (-0.94%)
Mutual labels:  laravel-package
laravel route summary
Create a summary of all the laravel routes
Stars: ✭ 11 (-89.62%)
Mutual labels:  laravel-package
voyager-page-blocks
A module to provide page blocks for Voyager 📝
Stars: ✭ 80 (-24.53%)
Mutual labels:  laravel-package
statamic-video-embed
A field type for embedding YouTube and Vimeo Videos
Stars: ✭ 16 (-84.91%)
Mutual labels:  vimeo
laravel-ab
Laravel A/B experiment testing tool
Stars: ✭ 108 (+1.89%)
Mutual labels:  laravel-package
simple-recaptcha-v3
🤖 This repository contains simple reCAPTCHA v3 integration for your Laravel application.
Stars: ✭ 25 (-76.42%)
Mutual labels:  laravel-package
laravel-dadata
PHP SDK Laravel пакет работы с сервисом DaData.ru, для исправления синтаксических ошибок в информации контактных данных клиентов сайта и вывода подсказок поля форм.
Stars: ✭ 39 (-63.21%)
Mutual labels:  laravel-package
haxe-c-bridge
Easily interact with haxe classes from C with an automatically generated C header
Stars: ✭ 46 (-56.6%)
Mutual labels:  embed
video-to-markdown
How to embed a video in markdown? Here the answer. Add videos to your markdown files easier.
Stars: ✭ 159 (+50%)
Mutual labels:  vimeo
laravel-smart-facades
Strategy design pattern in laravel, the easiest way.
Stars: ✭ 84 (-20.75%)
Mutual labels:  laravel-package
node.lua
Platform for Internet of Things with Lua, Modern IoT device embedded software development platform.
Stars: ✭ 17 (-83.96%)
Mutual labels:  embed
laravel-snowflake
This Laravel package to generate 64 bit identifier like the snowflake within Twitter.
Stars: ✭ 94 (-11.32%)
Mutual labels:  laravel-package

Laravel Embed

Laravel Embed

Effortless responsive embeds for videos, slideshows and more.
Created by Ben Sampson

Packagist Stable Version Packagist downloads MIT Software License

Requirements

  • Laravel 7.25 or newer
  • PHP 7.4.0 or newer

Installation

1. Composer

composer require bensampo/laravel-embed

2. Include styles

Somewhere inside the <head> element of the document, include:

<x-embed-styles />

If you'd prefer to include the styles in your own CSS file, you may copy the contents of styles.blade.php.

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

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.

<x-embed url="https://www.youtube.com/watch?v=oHg5SJYRHA0" />

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.

<x-embed url="https://www.youtube.com/watch?v=oHg5SJYRHA0" aspect-ratio="4:3" />

The aspect ratio is maintained at different viewport sizes.

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

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

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

See the full list →

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].