Alexandre Debril

web programmer & open source contributor

With PHP 5 reaching its end of life at the end of 2018, it's time for modern libraries to move on and take advantage of PHP 7 features such as return types and scalar type declarations. So I did it to feed-io in the next release to come, tagged 4.0 and in beta phase until mid-September followed by a two weeks RC phase and then a final release in early October.

What will change in feed-io 4.0 :

  • PHP 5 will no longer be supported in this version
  • Return and argument types are declared in function declarations
  • Some bugs due to past versions' design are fixed
  • Memory usage optimization

Users of feed-io 3 will have to adapt all classes implementing interfaces like FeedInterface to add the type hints in functions' declarations. By the way : feed-io 3 will be supported until the end of 2018 so don't panic if you didn't plan to upgrade soon.

I am looking for testers and feedback will be highly appreciated. You can submit your issues in the project's Github repository, I will give you an answer as soon as possible.

In my previous post I introduced JSON Feed, a new syndication standard published on May 17, 2017.

And now feed-io supports this new format since the last release. It was tagged 3.0 as it breaks compatibility with the previous version, which was a necessary evil because FeedIo::format() returned a DomDocument, no longer relevant. Now this method returns a string you can display without calling saveXML() anymore. This is the main change from 2.x to 3.0 and if you need to know everything on how to upgrade your code, please refer to the upgrade guide.

For those how don't know feed-io yet, it is a PHP library built to read and write feeds initially written with RSS and Atom formats in mind. I sometimes had the feeling that one day a JSON standard will come this way, but I always ended thinking "nay, not that year". Good news : I'm finally wrong ! And I guess nobody cares about what I am thinking, so now I'll get to the point : the code.

Continue reading

In version 2.4, feed-io introduces the ability to convert feeds in valid JSON string :


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

$feed = $feedIo->read('http://php.net/feed.atom')->getFeed();

echo json_encode($feed);

The whole feed is exported in the JSON string, including medias, categories and additional elements.

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 :

[code language="bash"] ./bin/feedio read http://php.net/feed.atom -c 1 [/code]

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.

In feed-io 2.2, I introduced a Factory class built to get a FeedIo instance in one single line of code :

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

Obviously this works assuming that you installed feed-io using Composer and you have included vendor/autoload.php before.

Factory's main method : Factory::create()

The factory comes with the ability to configure feed-io before getting its main class. For that, you will provide one or two configuration arrays depending on which dependency you want to configure.

Continue reading

Edit : the bundle is no longer supported, see this announcement

I recently released version 3.0 of feed-io-bundle. Symfony 3.0 introduced a backward compatibility break in forms support, so it became impossible to maintain a code base compatible with both versions.

Symfony 2.x support

I created a branch called release/2.x to maintain feed-io-bundle version 2. It will last until the end of the Symfony 2.x official support. This branch will be used for bug fixes only, all the new features will be committed to the master branch.

Edit : the bundle is no longer supported, see this announcement

I recently released version 2.1.1 of feed-io-bundle. This is a major release as it introduces a web interface made to manage feeds and their content which you can try live here : http://feedio-demo.herokuapp.com/.

It's also official : feed-io-bundle replaces rss-atom-bundle. If you're starting a new Symfony project, I highly recommend you to use feed-io-bundle instead of rss-atom-bundle. feed-io-bundle will be upgraded regularly with new features and fixes among compatibility with Symfony.

Rss-atom-bundle's support

rss-atom-bundle is not condemned to disappear immediately, I will provide a "passive support" until it's not used anymore. By passive support, I mean taking care of open issues and pull requests until the end. So if you already have a project depending on rss-atom-bundle you don't have to be afraid of this announcement, I'll always be able to help.

Coming next

I'm working on two things by now :

  • Symfony 3 compatibility
  • the ability to analyse feed's quality with feed-io

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 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.

Continue reading

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.

rss-atom-bundle 1.5.6 has just been released. Thanks to this pull request, it fixes a deprecated tag in the routing configuration : "pattern" will no longer exist in Symfony 3.0 and is replaced with the "path" attribute.

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.

feed-io is entering its beta stage this week. That means I will write tests scripts with real world examples, finish the documentation and release the first beta version. Right after that I'll take one month to cover your feedback and eventually release a second beta version.