Download the PHP package webwizardsusa/laravel-oembed without Composer
On this page you can find all versions of the php package webwizardsusa/laravel-oembed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download webwizardsusa/laravel-oembed
More information about webwizardsusa/laravel-oembed
Files in webwizardsusa/laravel-oembed
Package laravel-oembed
Short Description Generate external embed code from a URL via the oembed protocol
License MIT
Homepage https://github.com/webwizardsusa/laravel-oembed
Informations about the package laravel-oembed
OEmbed For Laravel
(NOTE: This package is in early development.)
This package allows you to retrieve embed information for URLs from various oembed providers, similar to Wordpress. Out of the box, we support the following websites:
- Amazon
- Bluesky
- Dailymotion
- Flickr
- Scribd
- Sound Cloud
- Spotify
- Tiktok
- Tumbler
- Vimeo
- Youtube
Providers can be disabled inside the configuration. Adding of additional providers is a rather simple process. See below.
Installation
You can install the package via composer:
Responsive Iframe CSS
This package makes responsive IFrames possible. To enabled them on your site, you need to add the following CSS to your site:
Configuration publishing
If you wish to alter the list of providers, or adjust any other configuration values, then you can publish the configuration with:
The following configuration values are available:
| Config | Env | Default | Description |
|---|---|---|---|
| providers | - | array | An array of enabled provider classes |
| cache.enabled | OEMBED_ENABLE_CACHE | true | Enables caching of responses |
| cache.ttl | OEMBED_URL_CACHE_TTL | 10080 | The number of minutes to cache successful responses |
| cache.invalid_ttl | OEMBED_INVALID_URL_CACHE_TTL | 10 | The number of minutes to cache invalid responses |
| cachek.key_prefix | OEMBED_CACHE_PREFIX | oembedurl | A prefix to attach to the key of all cached items |
| cache.driver | OEMBED_CACHE_DRIVER | null | The cache driver to use |
Usage
Usage is very simple. Just utilize the OEmbed service to retrieve information about a URL.
Running that will result in the following output:
The fromUrl() method will return a OEmbedResponse if successful, or null if not successful.
You can also render the embed from the OEmbedResponse by calling the render() method. Rending is done through views. Each provider decides which view to use, html, iframe or responsive-iframe.
Providers
For the most part providers are very simple classes:
A simple array of regex patterns to match the URL, then the url of that services oembed service. While this works for a majority of the providers, sometimes you may need to extend how information is retrieved. To do that, you can override pull() on the provider class:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
This package is developed by WebWizardsUSA.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-oembed with dependencies
illuminate/support Version ^10.0|^11.0
illuminate/http Version ^10.0|^11.0
illuminate/contracts Version ^10.0|^11.0
ext-dom Version *