Feed-io v2.3 : the CLI is here

From now on, feed-i is a little bit more than a library. Since version 2.3, it comes with a basic client you can use through your terminal :

./bin/feedio read http://php.net/feed.atom -c 1

The instruction above will fetch php.net’s feed and display its latest item. I used the “count” option to get only one, but this is not mandatory; without it, feed-io displays all the items included in the feed.

The command line interface will probably be the main subject of the next few releases. I’m thinking about features like JSON output or items ordering and if you have any suggestion, feel free to submit a new issue on Github.

Advertisements

rss-atom-bundle 2.2 is out

rss-atom-bundle 2.2.0 has just been released. It brings the following :

– exceptions are all under the same namespace
– ability to write enclosures
– cache-control can be set to private if you need to disable caching from proxies

This version breaks backward compatibility, the upgrade process from 1.x is described in this notice.

Why a 2.x version ?

Two weeks ago, Soullivaneuh and Romaric Drigon created 7 pull requests in less than 48 hours bringing new features, code cleaning and a better exception handling. Before that, I merged a pull request fixing Symfony 3 compatibility. Although I announced at the beginning of the year that FeedIoBundle will be the next rss-atom-bundle and scheduled its end of life to match the 2.x branch of Symfony, things turned differently. Some developers are still using rss-atom-bundle and they submitted pull requests to make it last longer than scheduled. I respect that and it makes me realize rss-atom-bundle is not under my sole control anymore, which is exciting.

As a consequence, rss-atom-bundle will be maintained to be compatible with both 2.x and 3.x branches of Symfony. The next version will feature a new RoutedItemOutInterface as specified in this issue, however its release date is still unknown.

feed-io 1.0.0 : a PHP library built to serve and consume Atom/RSS feeds

feed-io has now finished its beta stage and is ready to be used in production environment. This library is 100 % pure PHP and depends only on PSR-2 for logging specifications. It also suggests Guzzle to consume external feeds, and if you don’t like this choice you’re free to write your own HTTP client and use it with feed-io.

features

Features are already listed in this previous post

To make it short, feed-io is able to serve and consume RSS / Atom news feeds with a strong OOP approach. It is flexible and you can use it to extend standard formats or to create your own if you need to.

design

feed-io is designed to be easily understood by anyone who wants to use it. It provides a façade to help you with the most common operations, but if you need more flexibility you can use the core classes.

FeedIo

This class is the facade, it provides methods to use feed-io’s main features.


$feedIo = new \FeedIo\FeedIo($client, $logger);

$result = $feedIo->read('https://debril.org/feed.atom');

echo 'feed title : ' . $result->getFeed()->getTitle() . PHP_EOL;

foreach( $result->getFeed() as $item ) {
    echo 'item title : ' . $item->getTitle() . PHP_EOL;
}

Result

This is the result of a read operation. It contains :

– the Feed instance
– Date and time of the request
– value of the ‘modifiedSince’ header sent throught the request
– the raw response
– the DOM document
– URL of the feed

So if you need to check something around the feed, it’s in the result.

StandardAbstract

Main standards are RSS, Atom and RDF and each of them are represented by a class extending StandardAbstract. A StandardAbstract instance is used for both parsing and formatting feeds using its RuleSet instances (one for the feed and one for the items).

So if you need to support a new format, it’s there. Just create a class extending StandardAbstract, implement the format’s specifications using the abstract methods and add it to feed-io. That’s it !

RuleSet and RuleAbstract

A RuleSet owns at least one rule (the default which is OptionalField). Each rule must be a RuleAbstract instance able to parse and format a DomElement according to its specifications. For instance, the Media class handles enclosure tags.

Each rule can be added to a ruleset instance at any time before parsing or formatting feeds.

FeedInterface

This interface defines the behaviour of a class containing the feed itself. It extends ArrayIterator and ItemInterface.

Feed

This is the FeedInterface implementation provided by feed-io. Feel free to extend it or to implement your own.

ItemInterface

Defines the behaviour of a class containing an item of the feed. It exposes methods to handle medias and  optional elements. It extends NodeInterface which is the lowest level of abstraction and exposes methods to get and set most common attributes like the title and the URL of an item.

Item

ItemInterface implementation provided by feed-io.

what’s coming next

Now that feed-io has been released in its first stable version, I will focus on FeedIoBundle to make it production ready before the end of June. So you can expect a first beta really soon.

rss-atom-bundle 1.6.0 is out

rss-atom-bundle 1.6.0 has just been released. This version brings enclosures support, that means you can now access embedded medias like images and podcasts.

Here’s a code sample :


// let's say $feed is a FeedContent instance
$items = $feed->getItems();

foreach ( $items as $item ) {
// getMedias() returns enclosures if any
$medias = $item->getMedias();
foreach ( $medias as $media ) {
echo $media->getUrl();
}
}

The next release of rss-atom-bundle is scheduled for the next couple of weeks. It will include this pull request, which goal is to improve rss-atom-bundle’s comprehension. But be careful, it breaks backward compatibility because all interfaces are renamed to follow Sensio Labs Insight’s recommendations.

feed-io 1.0.0-beta-1 is out

feed-io is a PHP library built to consume and serve RSS / Atom feeds. It features:

  • Atom / RSS read and write support
  • HTTP Headers support when reading feeds in order to save network traffic
  • Detection of the format (RSS / Atom) when reading feeds
  • Enclosure support to handle external medias like audio content
  • PSR compliant logging
  • Content filtering to fetch only the newest items
  • Malformed feeds auto correction
  • DateTime detection and conversion
  • A generic HTTP ClientInterface
  • Guzzle Client integration

Version 1.0.0-beta-1 has just been released, that means feed-io enters now its beta stage. If you find bugs or any kind of issues, please report them in the issue tracker. The beta stage will last for one month, the targeted stable release date is June 1st, 2015.