PHPackages                             treehouselabs/feeder - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. treehouselabs/feeder

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

treehouselabs/feeder
====================

Library containing functions to download, parse, transform and export different types of feeds.

v1.1.5(8y ago)210.7k11MITPHPPHP &gt;=5.5

Since Apr 3Pushed 8y ago4 watchersCompare

[ Source](https://github.com/treehouselabs/feeder)[ Packagist](https://packagist.org/packages/treehouselabs/feeder)[ RSS](/packages/treehouselabs-feeder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (7)Versions (9)Used By (1)

Feeder
======

[](#feeder)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a53129bb65ec5be817119c36acb9feb0f45a35e995864db562920ff973c84ee7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74726565686f7573656c6162732f6665656465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/treehouselabs/feeder)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/89718af3b9681765b7e5818a52a449d8d07ad06c25ba7d67a3ad02c9c2cbf740/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f74726565686f7573656c6162732f6665656465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/treehouselabs/feeder)[![Coverage Status](https://camo.githubusercontent.com/af5a0e3df797e52e57142658a81e5e91405cb276cafbc72b3c911504de1ddc84/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f74726565686f7573656c6162732f6665656465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/treehouselabs/feeder/code-structure)[![Quality Score](https://camo.githubusercontent.com/80b57918a437ff8fb56746460a3e9c0d51d94ce4a7726668ec46d255b93da27e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74726565686f7573656c6162732f6665656465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/treehouselabs/feeder)

Library containing functions to download, parse, transform and export different types of feeds.

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

[](#installation)

```
composer require treehouselabs/feeder:~1.0
```

Usage
-----

[](#usage)

Here's a simple feed processing script:

```
// create a new reader, in this case we'll fetch a feed from the interwebs
$resource = new FileResource(HttpTransport::create('http://example.org/feed'));
$reader = new XmlReader($resource);

// tell the reader to pull  nodes
$reader->setNodeCallback('item');

// create a feed for this reader
$feed = new Feed($reader);

// now simply iterate over the items
foreach ($feed as $item) {
    // $item is a ParameterBag instance with the serialized  node as data
}
```

Modifiers
---------

[](#modifiers)

Feeder becomes really powerful when you start adding modifiers. Modifiers are applied to each item and can be used to transform field values, remap keys, remove/add new values, etc.

Say we have the following `` node in the feed we want to process:

```

  The quick brown fox jumps over the lazy dog
  Thu, 05 Mar 2015 20:24:38 +0000
  yes

```

This will give the following item:

```
[
  'title' => 'The quick brown fox jumps over the lazy dog',
  'publishDate' => 'Thu, 05 Mar 2015 20:24:38 +0000',
  'explicit' => 'yes',
  'link' => [
    '#'     => '',
    '@href' => 'http://example.org/articles/1'
  ],
]
```

If for some reason your OCD-levels are like mine and you want data to be snake\_cased:

```
$feed->addTransformer(new LowercaseKeysTransformer());

// will return:
[
  'title' => 'The quick brown fox jumps over the lazy dog',
  'publish_date' => 'Thu, 05 Mar 2015 20:24:38 +0000',
  'explicit' => 'yes',
  'link' => [
    '#'     => '',
    '@href' => 'http://example.org/articles/1'
  ],
]
```

Now we want the publish date to be an actual `DateTime` instance:

```
// the DataTransformer wraps a transformer for a specific field,
// instead of the whole item
$transformer = new DataTransformer(
    new StringToDateTimeTransformer(DATE_RFC2822),
    'publish_date'
);
$feed->addTransformer($transformer);

// will return:
[
  'title' => 'The quick brown fox jumps over the lazy dog',
  'publish_date' => DateTime::__set_state(array(
    'date' => '2015-03-05 20:24:38.000000',
    'timezone_type' => 1,
    'timezone' => '+00:00',
  )),
  'explicit' => 'yes',
  'link' => [
    '#'     => '',
    '@href' => 'http://example.org/articles/1'
  ],
]
```

Some more examples:

```
$feed->addTransformer(
  new DataTransformer(
    new StringToBooleanTransformer(),
    'explicit'
  )
);
$feed->addTransformer(
    new DataTransformer(
        new CallbackTransformer(function ($value) { return $value['@href']; }),
        'link'
    )
);

// will return:
[
  'title' => 'The quick brown fox jumps over the lazy dog',
  'publish_date' => DateTime::__set_state(array(
    'date' => '2015-03-05 20:24:38.000000',
    'timezone_type' => 1,
    'timezone' => '+00:00',
  )),
  'explicit' => true,
  'link' => 'http://example.org/articles/1',
]
```

As you can see you can create really powerful chains of modifiers to get the outcome you want. Modifiers are not limited to transformative functions, there are mappers (map keys in the item to your own fields), filters (exclude items based on your own logic) and validators (raises exceptions when an item is invalid). There are a lot of modifiers that come with this library, [check them out](/src/TreeHouse/Feeder/Modifier)!

Testing
-------

[](#testing)

```
composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Credits
-------

[](#credits)

- [Peter Kruithof](https://github.com/treehouselabs)
- [All Contributors](../../contributors)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 63.8% 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.

###  Release Activity

Cadence

Every ~140 days

Recently: every ~99 days

Total

8

Last Release

3079d ago

Major Versions

v0.1.0 → v1.0.02015-10-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e70c4936c5121b835d48680dcf4bb57d21724c533dd99591e80101e4a25dd6?d=identicon)[pkruithof](/maintainers/pkruithof)

![](https://www.gravatar.com/avatar/aa2b08ed7a87334a1a0b8e302759c3587e4cbea1a1efb08f23d55cd04d1ccfc0?d=identicon)[marcojanssen](/maintainers/marcojanssen)

---

Top Contributors

[![pkruithof](https://avatars.githubusercontent.com/u/330828?v=4)](https://github.com/pkruithof "pkruithof (37 commits)")[![fieg](https://avatars.githubusercontent.com/u/1086908?v=4)](https://github.com/fieg "fieg (18 commits)")[![cleentfaar](https://avatars.githubusercontent.com/u/795661?v=4)](https://github.com/cleentfaar "cleentfaar (1 commits)")[![mvanduijker](https://avatars.githubusercontent.com/u/1771206?v=4)](https://github.com/mvanduijker "mvanduijker (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

feed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/treehouselabs-feeder/health.svg)

```
[![Health](https://phpackages.com/badges/treehouselabs-feeder/health.svg)](https://phpackages.com/packages/treehouselabs-feeder)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)

PHPackages © 2026

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