Html
HTML utility class. This class provides utility methods for HTML manipulation.
Table of Contents
Methods
- getImageFromMetaTags() : string|null
- Get the image URL from Open Graph or Twitter meta tags.
- getOpenGraphMetaTags() : array<string|int, mixed>
- Extract Open Graph meta tags from HTML content.
- getTwitterMetaTags() : array<string|int, mixed>
- Extract Twitter meta tags from HTML content.
Methods
getImageFromMetaTags()
Get the image URL from Open Graph or Twitter meta tags.
public
static getImageFromMetaTags(string $html) : string|null
Parameters
- $html : string
-
The HTML content to parse
Return values
string|null —The image URL if found, null otherwise
getOpenGraphMetaTags()
Extract Open Graph meta tags from HTML content.
public
static getOpenGraphMetaTags(string $html) : array<string|int, mixed>
Parameters
- $html : string
-
The HTML content to parse
Return values
array<string|int, mixed> —An associative array of Open Graph meta tags
getTwitterMetaTags()
Extract Twitter meta tags from HTML content.
public
static getTwitterMetaTags(string $html) : array<string|int, mixed>
Parameters
- $html : string
-
The HTML content to parse
Return values
array<string|int, mixed> —An associative array of Twitter meta tags