API

Table of Contents

The following list provides information for all necessary interfaces and classes that are used inside of this documentation. For up to date information, please check the source code.

Interfaces

interface Brotkrueml\FeedGenerator\Feed\FeedInterface

Has to be implemented to provide a feed. It extends Brotkrueml\FeedGenerator\Feed\NodeInterface.

getDescription()
Return type

string

Returns

The description of the feed. Return an empty string to omit the property in the feed.

getLanguage()
Return type

string

Returns

The language of the feed. Return an empty string to omit the property in the feed.

Return type

string

Returns

The logo of the feed. Return an empty string to omit the property in the feed.

getItems()
Return type

ItemInterface[]

Returns

The items of the feed. Return an empty array to omit the property in the feed.

interface Brotkrueml\FeedGenerator\Feed\FeedFormatAwareInterface

This interface is used in combination with the Brotkrueml\FeedGenerator\Feed\FeedInterface to set the current feed format into a feed implementation. It can be used in combination with the Brotkrueml\FeedGenerator\Feed\StyleSheetAwareInterface to provide different XSL stylesheets for Atom and RSS feeds.

setFormat($format)

In the implementation of this method store the format in a property of your class for later usage.

Parameters
interface Brotkrueml\FeedGenerator\Feed\ItemInterface

Has to be implemented to provide an item of the feed. It extends Brotkrueml\FeedGenerator\Feed\NodeInterface. The extension provides already an implementation (Brotkrueml\FeedGenerator\Feed\Item) which can be used. However, if you have special needs you can use this interface to implement a custom item class.

getSummary()
Return type

string

Returns

The summary of the feed. Return an empty string to omit the property in the feed.

getContent()
Return type

string

Returns

The content of the feed. Return an empty string to omit the property in the feed.

Note

When the item is used for an RSS feed, the summary is not displayed, the content is used for the description tag of an item.

interface Brotkrueml\FeedGenerator\Feed\NodeInterface

This interface is extended by the Brotkrueml\FeedGenerator\Feed\FeedInterface and the Brotkrueml\FeedGenerator\Feed\ItemInterface.

getLastModified()
Return type

?DateTimeInterface

Returns

The date and time of the last modification. Return null to omit the property in the feed.

getTitle()
Return type

string

Returns

The title. Return an empty string to omit the property in the feed.

getPublicId()
Return type

string

Returns

The ID. Return an empty string to omit the property in the feed.

Return type

string

Returns

The link. Return an empty string to omit the property in the feed.

interface Brotkrueml\FeedGenerator\Feed\RequestAwareInterface

This interface is used in combination with the Brotkrueml\FeedGenerator\Feed\FeedInterface to inject the request into a feed implementation.

setRequest($request)

In the implementation of this method store the request object in a property of your class for later usage.

Parameters
  • $request (Psr\Http\Message\ServerRequestInterface) -- The request object.

interface Brotkrueml\FeedGenerator\Feed\StyleSheetAwareInterface

This interface is used in combination with the Brotkrueml\FeedGenerator\Feed\FeedInterface to get an XSL stylesheet which is applied to an Atom or RSS feed.

getStyleSheet()
Return type

string

Returns

The path to an XSL stylesheet. Return an empty string to omit the adding of the stylesheet to the XML feed.

Classes

class Brotkrueml\FeedGenerator\Feed\Item

The class implements the Brotkrueml\FeedGenerator\Feed\ItemInterface and can be used to collect the items for a feed.

__construct()
Parameters
  • $title (string) -- The title of the item.

  • $publicId (string) -- The ID of the item.

  • $lastModified (?DateTimeInterface) -- The last modification date of the item.

  • $link (string) -- The link of the item.

  • $summary (string) -- The summary of the item.

  • $content (string) -- The content of the item.

Tip

For better readability or when omitting some of the parameters use named arguments:

$item = new Brotkrueml\FeedGenerator\Feed\Item(
   title: 'The title',
   link: 'https://example.com/the/page',
   summary: 'Some summary',
);
getTitle()
Return type

string

Returns

The title of the item.

getPublicId()
Return type

string

Returns

The ID of the item.

getLastModified()
Return type

?DateTimeInterface

Returns

The last modification date of the item.

Return type

string

Returns

The link of the item.

getSummary()
Return type

string

Returns

The summary of the item.

getContent()
Return type

string

Returns

The content of the item.

Enumerations

class Brotkrueml\FeedGenerator\Feed\FeedFormat

The enumeration provides the following names which describe the available feed formats:

  • ATOM

  • JSON

  • RSS

Note

Only the enumeration names are public API. Methods that may be available are not part of the backwards-compatible promise and can change at any time without prior notice!