Simple RSS feed reader for PHP.
composer require chipslays/rss-feedly
Simple example:
use Feedly\Feedly;
require __DIR__ . '/vendor/autoload.php';
$feed = (new Feedly)->get('https://www.rt.com/rss/news/');
foreach ($feed->posts as $post) {
echo $post['title'] . PHP_EOL;
}
And much advanced example:
use Feedly\Feedly;
require __DIR__ . '/vendor/autoload.php';
$posts = $rss
->get('https://www.rt.com/rss/news/')
->except(['Trump'], ['title'])
->except(['Politics'], ['category'])
->priority([
[100, ['Google', 'Tesla', 'Durov'], ['title', 'description']],
[Feedly::DEFAULT_PRIORITY + 1, ['Apple'], ['description']],
]);
// get posts in the last 6 hours
$posts = $posts->where('date', '>', strtotime('-6 hours'));
// can use foreach or `each` method
$posts->each(function ($post) {
echo $post['title'] . PHP_EOL;
});
foreach ($posts as $post) {
// ...
}
More exampels can be found here
.
MIT.