定制 tentaclefeed/feedreader 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tentaclefeed/feedreader

Composer 安装命令:

composer require tentaclefeed/feedreader

包简介

A Simple Feed Reader Laravel Package

README 文档

README

Please note: This package is still under development and not yet intended for productive usage but feel free to contribute.

Tentaclefeed FeedReader

tests CodeFactor Packagist Version Packagist Downloads Gitmoji Packagist License

With this package it is easy to discover, read and parse RSS and ATOM feeds.

Installation

You can install this package via composer using:

composer require tentaclefeed/feedreader

The package will automatically register itself.

Publish configuration

To publish the FeedReader config file run:

php artisan vendor:publish --provider="Tentaclefeed\Feedreader\FeedreaderServiceProvider" --tag="config"

The default config file contains the following:

return [
    /*
    |--------------------------------------------------------------------------
    | Cache configuration
    |--------------------------------------------------------------------------
    |
    | The FeedReader and Explorer can cache requests automatically for you to
    | increase performance.
    |
    */
    'cache' => [
        'explorer' => [
            'seconds' => 86400, // One day
        ],
        'reader' => [
            'seconds' => 1800, // 30 minutes
        ],
    ],
];

Usage

Discover Feeds

use Tentaclefeed\Feedreader\Facades\FeedReader;

$feeds = FeedReader::discover('https://www.nytimes.com/');

/*
Illuminate\Support\Collection {#491
  #items: array:1 [
    0 => array:3 [
      "title" => "RSS",
      "icon" => "http://nytimes.com/vi-assets/static-assets/apple-touch-icon-28865b72953380a40aa43318108876cb.png"
      "type" => "application/rss+xml",
      "href" => "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
    ]
  ]
}
*/

Read Feed

use Tentaclefeed\Feedreader\Facades\FeedReader;

$feed = FeedReader::read('https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml');

/* 
Tentaclefeed\Feedreader\Models\Feed {#430
  -title: "NYT > Top Stories"
  -subtitle: ""
  -icon: null
  -updated_at: Carbon\Carbon @1619976397 {#485}
  -author: null
  -rights: "Copyright 2021 The New York Times Company"
  -items: Illumin…\Collection {#487}
}
*/

API

Tentaclefeed\Feedreader\Models\Feed

Method Return type Description
$feed->getTitle() string The title of the feed.
$feed->getSubtitle() string The subtitle/description of the feed.
$feed->getUpdatedAt() Carbon\Carbon The last modification date of the feed.
$feed->getAuthor() Tentaclefeed\Feedreader\Models\Author The author of the feed.
$feed->getRights() string Copyright notices.
$feed->getItems() Illuminate\Support\Collection Articles from the feed.

Tentaclefeed\Feedreader\Models\Author

Method Return type Description
$author->getName() string The name of the author.
$author->getUri() string or null The uri of the author.

Tentaclefeed\Feedreader\Models\FeedItem

Method Return type Description
$item->getId() string The id of the item.
$item->getTitle() string The title of the item.
$item->getCreatedAt() Carbon\Carbon The datetime the item was published/created.
$item->getUrl() string The url of the item.
$item->getSummary() string The content summary of the item.

Testing

Run the tests with:

composer test

TODO

  • Improve IconScraper to recognize more icons

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 42
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固