tentaclefeed / feedreader
A Simple Feed Reader Laravel Package
Fund package maintenance!
marcreichel
Requires
- php: ^8.0
- ext-curl: *
- ext-dom: *
- ext-imagick: *
- ext-libxml: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.3
- illuminate/support: ^8.40
- intervention/image: ^2.5
- nesbot/carbon: ^2.46.0
Requires (Dev)
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.5
README
Please note: This package is still under development and not yet intended for productive usage but feel free to contribute.
Tentaclefeed FeedReader
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
Tentaclefeed\Feedreader\Models\Author
Tentaclefeed\Feedreader\Models\FeedItem
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.