PHPackages                             surface/commonmark-ext-spotify-iframe - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. surface/commonmark-ext-spotify-iframe

ActiveCommonmark-extension[Parsing &amp; Serialization](/categories/parsing)

surface/commonmark-ext-spotify-iframe
=====================================

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

2.1.0(3y ago)03.6k↓32.1%MITPHPPHP ^8.0

Since Apr 13Pushed 3y ago1 watchersCompare

[ Source](https://github.com/trovster/commonmark-ext-spotify-iframe)[ Packagist](https://packagist.org/packages/surface/commonmark-ext-spotify-iframe)[ Docs](https://github.com/trovster/commonmark-ext-spotify-iframe)[ RSS](/packages/surface-commonmark-ext-spotify-iframe/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (7)Used By (0)

Spotify iframe extension
========================

[](#spotify-iframe-extension)

An extension for [league/commonmark](https://github.com/thephpleague/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](https://github.com/zoonru/commonmark-ext-youtube-iframe).

Installation
------------

[](#installation)

The project should be installed via Composer:

```
composer require surface/commonmark-ext-spotify-iframe
```

Usage
-----

[](#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

[](#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
-------

[](#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
---------

[](#changelog)

Please refer to the [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

This library is licensed under the MIT license. See the [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~59 days

Total

5

Last Release

1259d ago

Major Versions

v1.x-dev → 2.0.02022-04-13

PHP version history (2 changes)1.0.0PHP ^7.4|^8.0

2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0fcbd1351650ca328e0ee494a7704fcbc393512d57234c694d02c37d1c86093?d=identicon)[trovster](/maintainers/trovster)

---

Top Contributors

[![trovster](https://avatars.githubusercontent.com/u/48729?v=4)](https://github.com/trovster "trovster (9 commits)")

---

Tags

commonmarkextensioniframemarkdownphpspotifymarkdowncommonmarkextensionembedspotifymusiciframe

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/surface-commonmark-ext-spotify-iframe/health.svg)

```
[![Health](https://phpackages.com/badges/surface-commonmark-ext-spotify-iframe/health.svg)](https://phpackages.com/packages/surface-commonmark-ext-spotify-iframe)
```

###  Alternatives

[zoon/commonmark-ext-youtube-iframe

Extension for league/commonmark to replace youtube link with iframe

12275.9k1](/packages/zoon-commonmark-ext-youtube-iframe)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
