Skip to content

alpineio/rss-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSS & Atom Feeds for PHP

Downloads this Month Latest Stable Version License

RSS & Atom Feeds for PHP is a very small and easy-to-use library for consuming an RSS and Atom feeds.

It requires PHP 5.2.2 or newer with CURL extension or enabled allow_url_fopen and is licensed under the New BSD License. You can obtain the latest version from our GitHub repository or install it via Composer:

php composer.phar require dg/rss-php

Usage

Download RSS feed from URL:

$rss = Feed::loadRss($url);

The returned properties are SimpleXMLElement objects. Extracting the information from the channel is easy:

echo 'Title: ', $rss->title;
echo 'Description: ', $rss->description;
echo 'Link: ', $rss->link;

foreach ($rss->item as $item) {
	echo 'Title: ', $item->title;
	echo 'Link: ', $item->link;
	echo 'Timestamp: ', $item->timestamp;
	echo 'Description ', $item->description;
	echo 'HTML encoded content: ', $item->{'content:encoded'};
}

Download Atom feed from URL:

$atom = Feed::loadAtom($url);

You can also enable caching:

Feed::$cacheDir = __DIR__ . '/tmp';
Feed::$cacheExpire = '5 hours';

(c) David Grudl, 2008 (http://davidgrudl.com)

About

Small and easy-to-use library for consuming RSS and Atom feeds

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%