Git Product home page Git Product logo

opml-feeds's Introduction

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);

opml-feeds's People

Contributors

clarence-eldefors avatar dpcat237 avatar jwpage avatar oziks avatar

Watchers

Tim Broder avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.