PHPackages                             benkle/feed-response - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. benkle/feed-response

ActiveLibrary

benkle/feed-response
====================

Mapper-based services for easy use RSS and Atom responses

06PHP

Since Oct 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/benkle-libs/feed-response)[ Packagist](https://packagist.org/packages/benkle/feed-response)[ RSS](/packages/benkle-feed-response/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

An extendable, auto mapping, PSR-7 compliant feed generator
===========================================================

[](#an-extendable-auto-mapping-psr-7-compliant-feed-generator)

Requirements
------------

[](#requirements)

- PHP 5.6+
- [benkle/feed-interfaces](https://packagist.org/packages/benkle/feed-interfaces) 1.1+
- [symfony/http-foundation](https://packagist.org/packages/symfony/http-foundation) 3.3+
- [psr/http-message](https://packagist.org/packages/psr/http-message) 1.0+

Installation
------------

[](#installation)

*FeedResponse* can be included in the usual way with composer:

```
    composer require benkle/feed-response
```

Usage
-----

[](#usage)

Feed responses are built using a factory, which requires a bit of a setup:

```
use \Benkle\FeedInterfaces as FeedInterfaces;
use \Benkle\FeedResponse\XmlMappers\Atom as Atom;
use \Benkle\FeedResponse\XmlMappers\RSS20 as RSS20;
use \Benkle\FeedResponse\Collections as Collections;
use \Benkle\FeedResponse\FeedResponseFactory;

// You need two feed mappers, each with a collection of mappers
// for specific parts of the feed.

$atomMappers = new Collections\FeedItemMapperCollection();
$atomMappers
    ->add(ItemInterface::class, new Atom\FeedItemMapper())
    ->add(EnclosureInterface::class, new Atom\EnclosureMapper())
    ->add(RelationLinkInterface::class, new Atom\RelationLinkMapper());
$atomMapper = new Atom\FeedMapper();
$atomMapper->setMapperCollection($atomMappers);

$rssMappers = new Collections\FeedItemMapperCollection();
$rssMappers
    ->add(ItemInterface::class, new RSS20\FeedItemMapper())
    ->add(EnclosureInterface::class, new RSS20\EnclosureMapper())
    ->add(RelationLinkInterface::class, new Atom\RelationLinkMapper(true));
$rssMapper = new RSS20\FeedMapper();
$rssMapper->setMapperCollection($rssMappers);

$feedResponseFactory = new FeedResponseFactory();
$feedResponseFactory
    ->setAtomMapper($atomMapper)
    ->setObjectMappers($objectMappers)
    ->setRssMapper($rssMapper)
    ->setFeedPrototype(/* Insert an instance of \Benkle\FeedInterfaces\FeedInterface here */)
    ->setRelationLinkPrototype(/* Insert an instance of \Benkle\FeedInterfaces\RelationLinkInterface here */);
```

Afterwards you can simply create a response object with the apropriate methods:

```
$atomFeed = $feedResponseFactory->atom($head, $items, $relations); // For an Atom feed
$rssFeed = $feedResponseFactory->rss($head, $items, $relations); // For an RSS 2.0 feed
```

These methods allow for some variation on it's three parameters:

- `$head` can be...
    - an associative array with the following keys: keyRSS tagAtom tagtitle`title``title`description`description``subtitle`modified`lastBuildDate``updated`link`link``link[rel=self]`id`guid``id`
    - an instance of `\Benkle\FeedInterfaces\FeedInterface`
- `$items` is an array of any type of object. Instances of `\Benkle\FeedInterfaces\FeedItemInterface` will be handled directly, for any other type of object you'll also need a matching object mapper.
- `$relations` is an array where elements can be any of these:
    - An instance of `\Benkle\FeedInterfaces\RelationLinkInterface`
    - A key-value pair that maps to this tag: ``
    - an associative array with the following keys: keytag attributeurl, href`href`relationType, rel`rel`mimeType, mime, type`type`title`title`

TODO
----

[](#todo)

- Moved included collection classes to a utility package (combine with `PriorityList` from [benkle/feed-parser](https://packagist.org/packages/benkle/feed-parser))

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/70253fd266a8069896d4d0265ba3d452d6e4a006cbf564a11bfaf692ca5bb44c?d=identicon)[bizzl-greekdog](/maintainers/bizzl-greekdog)

---

Top Contributors

[![bizzl-greekdog](https://avatars.githubusercontent.com/u/424349?v=4)](https://github.com/bizzl-greekdog "bizzl-greekdog (31 commits)")

### Embed Badge

![Health badge](/badges/benkle-feed-response/health.svg)

```
[![Health](https://phpackages.com/badges/benkle-feed-response/health.svg)](https://phpackages.com/packages/benkle-feed-response)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
