mhrlab / youtube-rss
Small and easy-to-use library for consuming YouTube feeds
v1.0.0
2021-10-05 00:11 UTC
Requires
- php: >=7.0
- ext-curl: *
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
This package is auto-updated.
Last update: 2025-06-06 11:36:13 UTC
README
Small and easy-to-use library for consuming YouTube feeds
Installation
To install YouTube-Rss, simply:
composer require mhrlab/youtube-rss
For latest commit version:
composer require mhrlab/youtube-rss:dev-master
Requirements
YouTube-Rss works with PHP 7.0, 7.1, 7.2, 7.3, 7.4, and 8.0.
Quick Start and Examples
More examples are available under /examples.
require 'vendor/autoload.php'; $rss = new Feed('https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID'); if ($rss->error){ /* print error message */ echo $rss->errorMessage; }else{ $array = $rss->toArray(); /*pass true to print json with header('content-type:application/json')*/ $rss->toJSON(true); }
require 'vendor/autoload.php'; $rss = new Feed(); /*set time_zone to receive all time&date in own timezone. */ $rss->time_zone = 'asia/kolkata'; $rss->loadRss('https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID'); if ($rss->error){ /* print error message */ echo $rss->errorMessage; }else{ $array = $rss->toArray(); /*pass true to print json with header('content-type:application/json')*/ $rss->toJSON(true); }
Contribute
- Check for open issues or open a new issue to start a discussion around a bug or feature.
- Fork the repository on GitHub to start making your changes.
- Write one or more tests for the new feature or that expose the bug.
- Make code changes to implement the feature or fix the bug.
- Send a pull request to get your changes merged and published.