定制 thanhsm/mediaembed 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

thanhsm/mediaembed

最新稳定版本:v1.0.1

Composer 安装命令:

composer require thanhsm/mediaembed

包简介

Generate media embed from NTC, Zing Mp3, Youtube

README 文档

README

Build Status Code Climate Latest Stable Version Total Downloads Latest Unstable Version License

Media Embed

Mp3, NTC, Youtube media embed

Installation

Add line

"require": {
    "thanhsm/mediaembed": "dev-master"
  }

To composer.json in your project and then run composer update

How to use ?

Input:

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

Process content

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

Get get parsed content

$contentProcessed = $content->getContent();

Example http://youtube.com will become <a href="http://youtube.com">youtube.com</a>

Check media object in content

$content->hasMedia();

If contain media you can get media object with

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

You can set media width/height simple by

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

Get Media Size

$media->getSize();

Get embed code (HTML)

$media->getHTML();

Output

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

Get all media data

$data = $media->getData();

You also call with chaining method

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

Output

$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.

统计信息

  • 总下载量: 23
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-06