API / Minn\Runtime / OEmbed

OEmbed final class

Minn\Runtime\OEmbed · public/minn/src/Minn/Runtime/OEmbed.php · 114 lines

oEmbed as data: provider matching against the wildcard table, response parsing, and the markup an oEmbed payload becomes.

Uses 1

Public

staticproviderFor(array $providers, string $url): ?string#

The endpoint of the provider whose mask matches a URL, or null.

$providersarray<string, array{0: string, 1: bool}>mask => [endpoint with {format}, mask is a regex]
staticparseJson(string $body): ?array#

An oEmbed JSON body as an array, or null.

@return array<string, mixed>|null
staticparseXml(string $body): ?array#

An oEmbed XML body as an array, or null.

@return array<string, mixed>|null
statichtml(array $data, string $url, Closure $escUrl, Closure $escAttr, Closure $escHtml): ?string#

The embed HTML for an oEmbed response, or null.

$dataarray<string, mixed>the oEmbed payload
$escUrlClosure(string): string@param Closure(string): string $escAttr @param Closure(string): string $escHtml
staticdiscovered(string $html, array $linktypes): ?string#

The provider endpoint a page names in its head: the first link of each oEmbed type (the linktypes map type to json or xml), JSON before XML, its address entity-decoded. Null when it names none.

$linktypesarray<string, string>
staticstripNewlines(string $html): string#

Drops newlines from embed markup while leaving the inside of <pre> blocks untouched.