lowel/rss

There is no license information available for the latest version (1.0.0) of this package.

php rss parser

1.0.0 2025-01-20 19:44 UTC

This package is auto-updated.

Last update: 2025-01-20 19:51:34 UTC


README

Installation

composer require lowel/rss

Usage

$xml = <<<xml
<?xml version="1.0"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
  <channel>
    <title>Lorem ipsum channel title</title>
    <item>
      <title>Lorem ipsum item title</title>
      <description>Lorem ipsum item description</description>
    </item>
  </channel>
</rss>
xml;


$client = (new \Lowel\Rss\Factory())->fromXml($xml);

// Lorem ipsum channel title
echo $client->getAttribute('title')->data() . PHP_EOL;

/** @var Lowel\Rss\RssObjectInterface $item */
foreach ($client->getAttribute('item') as $item) {
    // Lorem ipsum item title
    echo $item->getAttribute('title')->data() . PHP_EOL;
    // Lorem ipsum item description
    echo $item->getAttribute('description')->data() . PHP_EOL;
}