phata / widgetfy
Widgetfy 是一个用于将视频网站 URL 转换为嵌入/小部件的 PHP 库。
v3.0
2024-06-27 17:59 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10
README
Widgetfy 是一个用于将视频网站 URL 转换为嵌入/小部件的 PHP 库。
安装
首先,将 composer 安装到您的开发平台。
然后在您的项目文件夹中运行以下命令
composer require phata/widgetfy
示例代码
// require the composer autoload script
require_once './vendor/autoload.php';
use Phata\Widgetfy\Core as Widgetfy;
// simple setup
if (($embed = Widgetfy::translate($link)) != NULL) {
echo $embed['html'];
}
// adjust all video to width 640px, if the source support that
$options = array('width'=>640);
if (($embed = Widgetfy::translate($link, $options)) != NULL) {
echo $embed['html'];
}
// using the default theme, and inlining the default CSS
// along with the first embed code.
echo Phata\Widgetfy\Theme::toHTML($embed, true);
有关更详细的文档,请访问我们的 GitLab 上的文档页面。
分支
分支 | 目的 | PHP 版本 | 状态 |
---|---|---|---|
3.x | 稳定/默认 | 8.1, 8.2, 8.3 | |
2.x | 维护 | 7.1, 7.2, 7.3, 7.4 | |
1.x | 维护 | 5.3, 5.4, 5.5, 5.6 | |
main | 开发 | 7.1, 7.2, 7.3, 7.4 |
许可证
此文件是 Widgetfy 的一部分。
Widgetfy 是免费软件:您可以按照自由软件基金会发布的 GNU 较小通用公共许可证的条款重新分配和/或修改它,许可证版本为 3 或(根据您的选择)任何更高版本。
Widgetfy 的分发是希望它有用,但没有任何保证;甚至没有关于其适销性或适用于特定目的的暗示性保证。有关更多详细信息,请参阅 GNU 较小通用公共许可证。
您应已收到 Widgetfy 一起提供的 GNU 较小通用公共许可证副本。如果没有,请参阅 https://gnu.ac.cn/licenses/lgpl.html。