dotsunited/embed-parser
Composer 安装命令:
composer require dotsunited/embed-parser
包简介
Simple utility to parse URLs in HTML or text content which are placed on its own line to turn them into embeds.
README 文档
README
Simple utility to parse URLs in HTML or text content which are placed on its own line to turn them into embeds.
Installation
Install the latest version with Composer.
composer require dotsunited/embed-parser
Check the Packagist page for all available versions.
Usage
There is single parse function provided which parses the given content and
invokes a handler callback for each URL found.
$transformedContent = DotsUnited\EmbedParser\parse($content, function ($url) { $embedHtml = tranformUrlToEmbedHtml($url); return $embedHtml; });
The URL must be on its own line or surrounded only by <p> tags with no other
text content to be parsed.
Text
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.
https://youtube.com/watch?v=QcIy9NiNbmo
At vero eos et accusam et justo duo dolores et ea rebum.
HTML
<p> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. </p> <p> https://youtube.com/watch?v=QcIy9NiNbmo </p> <p> At vero eos et accusam et justo duo dolores et ea rebum. </p>
License
Copyright (c) 2017 Dots United GmbH. Released under the MIT license.
统计信息
- 总下载量: 24
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-16