chipslays/rss-feedly

简单的 RSS 订阅阅读器。

2.0.1 2021-12-24 05:43 UTC

This package is auto-updated.

Last update: 2024-09-29 06:08:56 UTC


README

PHP 的简单 RSS 订阅阅读器。

安装

composer require chipslays/rss-feedly

用法

简单示例

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;
}

更多高级示例

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) {
    // ...
}

示例

更多示例可以在 这里 找到。

许可证

MIT.