PHP code example of tentaclefeed / feedreader

1. Go to this page and download the library: Download tentaclefeed/feedreader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tentaclefeed / feedreader example snippets


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
        ],
    ],
];

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"
    ]
  ]
}
*/

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}
}
*/
bash
php artisan vendor:publish --provider="Tentaclefeed\Feedreader\FeedreaderServiceProvider" --tag="config"