2017 © Pedro Peláez
 

library mediaembed

Generate media embed from NTC, Zing Mp3, Youtube

image

thanhsm/mediaembed

Generate media embed from NTC, Zing Mp3, Youtube

  • Friday, April 10, 2015
  • by thanhsm
  • Repository
  • 1 Watchers
  • 0 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Build Status Code Climate Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Media Embed

Mp3, NTC, Youtube media embed, (*2)

Installation

Add line, (*3)

"require": {
    "thanhsm/mediaembed": "dev-master"
  }
  ```
To composer.json in your project and then run ```composer update```

# How to use ?
Input:

```php
<?php
$input = 'Link here http://mp3.zing.vn/bai-hat/Vi-Ai-Vi-Anh-Dong-Nhi/ZW70UWO6.html';

Process content, (*4)

$content = new MediaEmbed($input);
or
$content = MediaEmbed::process($input);

Get get parsed content, (*5)

$contentProcessed = $content->getContent();

Example http://youtube.com will become <a href="http://youtube.com">youtube.com</a>, (*6)

Check media object in content, (*7)

$content->hasMedia();

If contain media you can get media object with, (*8)

if ($content->hasMedia()) {
    $media = $content->getMediaProvider();
}

You can set media width/height simple by, (*9)

//pixel
$media->setWidth(200);
$media->setHeight(100);
or
$media->setSize(200, 100);

Get Media Size, (*10)

$media->getSize();

Get embed code (HTML), (*11)

$media->getHTML();

Output, (*12)

<iframe width="200" height="100" src="http://mp3.zing.vn/embed/song/ZW70UWO6?autostart=false" frameborder="0" allowfullscreen="true"></iframe>

Get all media data, (*13)

$data = $media->getData();

You also call with chaining method, (*14)

$data = $content->getMediaProvider()->getData()

Output, (*15)

$data = [
    'provider' => 'mp3',
    'embed_type' => 'song',
    'id' => ZW70UWO6,
    'html' => '<iframe width="200" height="100" src="http://mp3.zing.vn/embed/song/ZW70UWO6?autostart=false" frameborder="0" allowfullscreen="true"></iframe>',
    'with' => default width,
    'height' => default height
];

All issues please post to here, thanks you., (*16)

The Versions

10/04 2015

dev-master

9999999-dev

Generate media embed from NTC, Zing Mp3, Youtube

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Thanh LS

10/04 2015

v1.0.0

1.0.0.0

Generate media embed from NTC, Zing Mp3, Youtube

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Thanh LS

10/04 2015

v1.0.1

1.0.1.0

Generate media embed from NTC, Zing Mp3, Youtube

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Thanh LS

10/04 2015

dev-develop

dev-develop

Generate media embed from NTC, Zing Mp3, Youtube

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Thanh LS