Skip to content

clarence-eldefors/opml-feeds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opml-feeds

Import/export feed lists in OPML format.

Install

Install using composer.

Import OPML file:

<?php
use Celd\Opml\Importer;
$importer = new Importer(file_get_contents('http://opml-url'));
$feedList = $importer->getFeedList();
foreach ($feedList->getItems() as $item) {
  if ($item->getType() == 'category') {
    echo $item->getTitle(); // Category title
    foreach($item->getFeeds() as $feed) {
      echo $feed->getTitle() . "\n";
    }
  }
  echo $item->getTitle(); //Root feed title
}

// Properties of Model/Feed are:
// title, xmlUrl, htmlUrl, type (rss/atom/etc)

Exporting OPML file

<?php
use Celd\Opml\Importer;
use Celd\Opml\Model\FeedList;
use Celd\Opml\Model\Feeed;

$feedList = new FeedList();

$feed = new Feed();
$feed->setTitle('Feed title');
$feed->setXmlUrl('http://rss-feed-url');
$feed->setType('rss');
$feed->setHtmlUrl('http://html-url');

$feedList->addItem($feed);

$importer = new Importer();
echo $importer->export($feedList);

About

Import/export feed lists in OPML format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages