定制 surface/commonmark-ext-spotify-iframe 二次开发

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

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

surface/commonmark-ext-spotify-iframe

最新稳定版本:2.1.0

Composer 安装命令:

composer require surface/commonmark-ext-spotify-iframe

包简介

Extension for league/commonmark to replace Spotify link with an iframe.

README 文档

README

An extension for league/commonmark version 2 built using PHP 8.0. This replaces Spotify links with the embed iframe.

The extension supports for tracks, artists, albums and playlists using the embed URL format.

Initially based on the YouTube extension.

Installation

The project should be installed via Composer:

composer require surface/commonmark-ext-spotify-iframe

Usage

Configure your CommonMark Environment and add the extension.

use League\CommonMark\Environment\Environment;
use League\CommonMark\MarkdownConverter as Converter;
use Surface\CommonMark\Ext\SpotifyIframe\Extension as SpotifyExtension;

$options = [
    'spotify_iframe' => [
        'size' => 'large',
    ],
];

$environment = new Environment($options);
$environment->addExtension(new SpotifyExtension());

$converter = new Converter($environment);

echo $converter->convert('[](https://open.spotify.com/embed/artist/xxx)');
echo $converter->convert('[](https://open.spotify.com/embed/track/xxx?theme=0)');
echo $converter->convert('[](https://open.spotify.com/embed/album/xxx?theme=1&size=small)');
echo $converter->convert('[](https://open.spotify.com/embed/playlist/xxx?theme=1&size=lg)');

Sizes

Spotify provides two different sizes, large and small. By default the extension provides the large version. You can configure the option globally using the size option.

You can also configure the size option using a query parameter on the embed URL. The supported sizes are large, lg, small and sm.

?size=large
?size=small
?size=lg
?size=sm

Testing

There are Unit and Integration tests for the project. These can be run using the following commands:

composer test
composer run test
composer run test-unit
composer run test-integration

There are also scripts to run code sniffer, mess detector and static analysis:

composer run sniff
composer run mess
composer run stan

Changelog

Please refer to the CHANGELOG for more information on what has changed recently.

License

This library is licensed under the MIT license. See the License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-05-13