Alexandre Debril

web programmer & open source contributor

feed-io 4.3 : feed discovery

In version 4.3, feed-io now gets the ability to discover feeds included in the head section of a HTML page. For instance, browse to and take a look at the page's sources. You'll see something like this in the head section :

  <title>PHP: Hypertext Preprocessor</title>

 <link rel="shortcut icon" href="">
 <link rel="search" type="application/opensearchdescription+xml" href="" title="Add search">
 <link rel="alternate" type="application/atom+xml" href="" title="PHP Release feed">
 <link rel="alternate" type="application/atom+xml" href="" title="PHP: Hypertext Preprocessor">

The interesting parts of it are the two <link rel="alternate" type="application/atom+xml" /> tags.

feed-io now gives you the ability to discover them with a few lines of code :

$feedIo = \FeedIo\Factory::create()->getFeedIo();
$feeds = $feedIo->discover($url);

foreach( $feeds as $feed ) {
    echo "discovered feed : {$feed}";

And there's more. You can also get them using its command-line interface :

./vendor/bin/feedio discover

Which outputs :

Discovering feeds from
found :
found :

That means you can now get all available feeds from a website before consuming them.