Download the PHP package cohensive/oembed without Composer

On this page you can find all versions of the php package cohensive/oembed. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oembed

Scrutinizer Code Quality Build Status Code Intelligence Status

OEmbed

PHP library to retreive and display embed media from various media providers that support OEmbed data format. Websites such as YouTube, Vimeo, Twitter, Imgur and others.

This library also comes with support for direct mp4/video sources and some of the media providers that don't use OEmbed.

Installation

Library is written in PHP 8 with various neat features it gives, so apologies to everybody who wanted to use it in previous versions of PHP. If you do need similar library, I could recommend checking my previous package in this field: cohensive/embed.

Add following require to your composer.json file:

"cohensive/oembed": "dev-master"
// or
"cohensive/oembed": "^0.16"

Then run composer install or composer update to download it and autoload.

Or run:

$ composer require cohensive/oembed

If you're installing this library and want to utilize it with Laravel, package should automatically load its Service Provider.

If you plan to use OEmbed facade with Laravel, add Facade to your app.php config file in aliases section:

'aliases' => array(

    //...
    'OEmbed' => 'Cohensive\OEmbed\Facades\OEmbed'
    //...

)

Usage

Standalone use:

// Use of factory will automatically load list of providers.
$factory = new \Cohensive\OEmbed\Factory();
$embed = $factory->get('http://youtu.be/uifYHNyH-jA');

if ($embed) {
    // Print default embed html code.
    echo $embed->html();

    // Print embed html code with custom width. Works for IFRAME and VIDEO html embed code.
    echo $embed->html(['width' => 600]);

    // Checks if embed data contains details on thumbnail.
    $embed->hasThumbnail();

    // Returns embed "src" - URL string / array of strings / null for current embed.
    // Accepts same options as "html" method.
    $embed->src();

    // Returns an array containing thumbnail details: url, width and height.
    $embed->thumbnail();

    // Returns an array containing all available embed data including default HTML code.
    $embed->data();
}

Laravel use:

// Either use Facade:
$embed = OEmbed::get('http://youtu.be/uifYHNyH-jA');

// Load via Dependency Injection:
public function method(OEmbed $oembed) {
    $embed = OEmbed::get('http://youtu.be/uifYHNyH-jA');
}

if ($embed) {
    // Print default embed html code.
    echo $embed->html();

    // Print embed html code with custom width. Works for IFRAME and VIDEO html embed code.
    echo $embed->html(['width' => 600]);

    // Checks if embed data contains details on thumbnail.
    $embed->hasThumbnail();

    // Returns an array containing thumbnail details: url, width and height.
    $embed->thumbnail();

    // Return thumbnail url if it exists or null.
    $embed->thumbnailUrl();

    // Returns an array containing all available embed data including default HTML code.
    $embed->data();
}

Config

Library comes with a big config file located in resources/ folder. That file contains an array where you can specify few things on a global basis and will you to pick which media providers you want to be used and which not.

Config file will be automatically loaded if you're using library with Laravel, which you can also publish and edit:

$ php artisan vendor:publish

If you're using OEmbed in standalone mode, you can add your own config file into Factory or OEmbed classes.

Important Changes

Config format changed to use snake_case array keys instead of previously used camelCase.


All versions of oembed with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cohensive/oembed contains the following files

Loading the files please wait ....