Apple News API PHP Client

Metadata
in package
implements JsonSerializable

FinalYes

Article metadata for Apple News Format.

Metadata provides information about the article that is not part of the document content itself, such as authors, canonical URLs, and keywords.

Tags
see
https://developer.apple.com/documentation/applenewsformat/metadata

Table of Contents

Interfaces

JsonSerializable

Properties

$authors  : array<string|int, string>
$canonicalURL  : string|null
$dateCreated  : string|null
$dateModified  : string|null
$datePublished  : string|null
$excerpt  : string|null
$generatorIdentifier  : string|null
$generatorName  : string|null
$generatorVersion  : string|null
$keywords  : array<string|int, string>
$links  : array<string|int, array<string, string>>
$thumbnailURL  : string|null
$transparentToolbar  : bool|null
$videoURL  : string|null

Methods

addAuthor()  : self
Add an author name.
addKeyword()  : self
Add a single keyword.
addKeywords()  : self
Add multiple keywords at once.
addLinkedArticle()  : self
Add a link to a related article or resource.
jsonSerialize()  : array<string, mixed>
setCanonicalURL()  : self
Set the canonical URL.
setDateCreated()  : self
Set the date the article was created.
setDateModified()  : self
Set the date the article was last modified.
setDatePublished()  : self
Set the date the article was published.
setExcerpt()  : self
Set the article excerpt/summary.
setGeneratorIdentifier()  : self
Set the generator identifier (e.g., 'Drupal').
setGeneratorName()  : self
Set the name of the tool that generated this document.
setGeneratorVersion()  : self
Set the version string for the generator tool.
setThumbnailURL()  : self
Set the thumbnail image URL for article discovery.
setTransparentToolbar()  : self
Enable or disable transparent toolbar in the news app.
setVideoURL()  : self
Set the video URL to be used in the article tile.

Properties

$authors

private array<string|int, string> $authors = []

List of author names.

$canonicalURL

private string|null $canonicalURL = null

Canonical URL of the original article.

$dateCreated

private string|null $dateCreated = null

ISO 8601 creation date.

$dateModified

private string|null $dateModified = null

ISO 8601 modification date.

$datePublished

private string|null $datePublished = null

ISO 8601 publication date.

$excerpt

private string|null $excerpt = null

Short summary of the article.

$generatorIdentifier

private string|null $generatorIdentifier = null

CMS or tool that generated the article.

$generatorName

private string|null $generatorName = null

Name of the generator tool.

$generatorVersion

private string|null $generatorVersion = null

Version of the generator tool.

$keywords

private array<string|int, string> $keywords = []

List of tags/keywords.

private array<string|int, array<string, string>> $links = []

Relationship links.

$thumbnailURL

private string|null $thumbnailURL = null

URL for the article's tile image.

$transparentToolbar

private bool|null $transparentToolbar = null

Whether the toolbar should be transparent.

$videoURL

private string|null $videoURL = null

URL for a video to play in the article tile.

Methods

addAuthor()

Add an author name.

public addAuthor(string $author) : self
Parameters
$author : string
Return values
self

addKeyword()

Add a single keyword.

public addKeyword(string $keyword) : self
Parameters
$keyword : string
Return values
self

addKeywords()

Add multiple keywords at once.

public addKeywords(array<string|int, string> $keywords) : self
Parameters
$keywords : array<string|int, string>
Return values
self

addLinkedArticle()

Add a link to a related article or resource.

public addLinkedArticle(string $url, string $relationship) : self
Parameters
$url : string

Target URL.

$relationship : string

Relationship type (e.g., 'related').

Return values
self

jsonSerialize()

public jsonSerialize() : array<string, mixed>
Return values
array<string, mixed>

setCanonicalURL()

Set the canonical URL.

public setCanonicalURL(string $url) : self
Parameters
$url : string
Return values
self

setDateCreated()

Set the date the article was created.

public setDateCreated(DateTimeInterface|string $date) : self
Parameters
$date : DateTimeInterface|string
Return values
self

setDateModified()

Set the date the article was last modified.

public setDateModified(DateTimeInterface|string $date) : self
Parameters
$date : DateTimeInterface|string
Return values
self

setDatePublished()

Set the date the article was published.

public setDatePublished(DateTimeInterface|string $date) : self
Parameters
$date : DateTimeInterface|string
Return values
self

setExcerpt()

Set the article excerpt/summary.

public setExcerpt(string $excerpt) : self
Parameters
$excerpt : string
Return values
self

setGeneratorIdentifier()

Set the generator identifier (e.g., 'Drupal').

public setGeneratorIdentifier(string $identifier) : self
Parameters
$identifier : string
Return values
self

setGeneratorName()

Set the name of the tool that generated this document.

public setGeneratorName(string $name) : self
Parameters
$name : string
Return values
self

setGeneratorVersion()

Set the version string for the generator tool.

public setGeneratorVersion(string $version) : self
Parameters
$version : string
Return values
self

setThumbnailURL()

Set the thumbnail image URL for article discovery.

public setThumbnailURL(string $url) : self
Parameters
$url : string
Return values
self

setTransparentToolbar()

Enable or disable transparent toolbar in the news app.

public setTransparentToolbar(bool $transparent) : self
Parameters
$transparent : bool
Return values
self

setVideoURL()

Set the video URL to be used in the article tile.

public setVideoURL(string $url) : self
Parameters
$url : string
Return values
self

        
On this page

Search results