PHPackages                             forensic/feed-parser - 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. forensic/feed-parser

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

forensic/feed-parser
====================

A fully integrated ATOM, RSS and RDF syndication feed parser

v1.2.2(6y ago)92.3k3[12 PRs](https://github.com/teclone/php-feed-parser/pulls)MITPHPPHP &gt;=7.1

Since Aug 26Pushed 3y agoCompare

[ Source](https://github.com/teclone/php-feed-parser)[ Packagist](https://packagist.org/packages/forensic/feed-parser)[ RSS](/packages/forensic-feed-parser/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (3)Versions (18)Used By (0)

PHP Feed Parser
===============

[](#php-feed-parser)

[![Build Status](https://camo.githubusercontent.com/1be00a2659cd66793b7a7b115d3011d7b3a97947d0d4a7e46be4c17fd53e07f2/68747470733a2f2f7472617669732d63692e6f72672f7465636c6f6e652f7068702d666565642d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/teclone/php-feed-parser)[![Coverage Status](https://camo.githubusercontent.com/4ef6278948deefc2695b21ca2a7b1f5fe4afa2a3dc334765d913b800bb04f527/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7465636c6f6e652f7068702d666565642d7061727365722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/teclone/php-feed-parser?branch=master)[![semantic-release](https://camo.githubusercontent.com/5f3b57745af83409bc673dec57e3eb360e1ec53b37ac29f81a319e347fa351c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2532302532302546302539462539332541362546302539462539412538302d73656d616e7469632d2d72656c656173652d6531303037392e737667)](https://github.com/semantic-release/semantic-release)[![Packagist](https://camo.githubusercontent.com/8138d6635ccfb72df53431177209757ddbeeda0b81a56e30f5d97303b4bae4fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f72656e7369632f666565642d7061727365722e737667)](https://camo.githubusercontent.com/8138d6635ccfb72df53431177209757ddbeeda0b81a56e30f5d97303b4bae4fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f72656e7369632f666565642d7061727365722e737667)

PHP Feed Parser is a fully integrated web syndication feed parser. It can successfully parse all the three major syndication feeds which include [RSS](http://cyber.harvard.edu/rss/rss.html), [ATOM](https://tools.ietf.org/html/rfc4287) &amp; [RDF](http://web.resource.org/rss/1.0/spec) feeds.

It produces clean, unified parse accross all the three supported feed types. It is configurable, lightweight, fully tested and allows one to parse feeds from three different sources that includes **parsing from url, from file or from string**.

Getting Started
---------------

[](#getting-started)

**Install via composer**:

```
composer require forensic/feed-parser
```

Create an instance as shown below:

```
//include composer autoload.php
require 'vendor/autoload.php';

//use the project's Parser module
use Forensic\FeedParser\Parser;

//create an instance
$parser = new Parser();

//parse yahoo rss news feed
$feed = $parser->parseFromURL('https://www.yahoo.com/news/rss/mostviewed');

//access feed properties
echo $feed->type; //1 for RSS, 2 for ATOM, 3 for RDF
echo $feed->title;
echo $feed->link;
echo $feed->lastUpdated;
echo $feed->generator;
echo $feed->description;
echo $feed->image->src;
....

//access items
$items = $feed->items;

foreach ($items as $item)
{
    //access feed item properties
    echo $item->link;
    echo $item->content;
    echo $item->textContent; // the same as content, but all html tags are stripped out
    echo $item->createdAt;
    echo $item->lastUpdated;
    echo $item->category;
    echo $item->image->src;
    echo $item->image->title;
    .....
}
```

Export Feed as JSON
-------------------

[](#export-feed-as-json)

You can also export the parsed feed as json, as shown below. This can also help you view all properties that are accessible in the parsed feed.

```
//create an instance
$parser = new Parser();

//parse yahoo rss news feed
$feed = $parser->parseFromURL('https://www.yahoo.com/news/rss/mostviewed');

header('Content-Type: application/json');

//export whole feed
echo $feed->toJSON();

//export a single item
echo $feed->items[0]->toJSON();
```

Parser Options
--------------

[](#parser-options)

The following configuration options can be passed in when creating an instance or set through the designated public methods:

```
//constructor signature
new Parser(
    string $default_lang = 'en',
    bool $remove_styles = true,
    bool $remove_scripts = true
);
```

- **default\_lang**:

    This option sets the default feed language property to use should there be no language entry found in the xml document.

    ```
    $parser = new Parser();
    $parser->setDefaultLanguage('fr');
    ```
- **remove\_styles**:

    This option states if stylings found in any feed item's content, should be stripped off. The stylings include html `style` element and attribute. Defaults to true.

    ```
    $parser = new Parser();
    $parser->removeStyles(true);
    ```
- **remove\_scripts**:

    This option states if any scripting found in any feed item's content, should be stripped off. Scripting includes html `script` element and event handler `on-prefixed` element attributes such as `onclick`. Defaults to true.

    ```
    $parser = new Parser();
    $parser->removeScripts(true);
    ```

Testing FeedParser
------------------

[](#testing-feedparser)

To locally test or contribute to this project, You should have at least php 7.1, xDebug, composer and npm installed, then ollow the steps below:

**Clone this repo**:

```
git clone https://github.com/teclone/php-feed-parser && php-feed-parser
```

**Install dependencies**:

```
composer install && npm install
```

**Run test**:

```
vendor/bin/phpunit
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity66

Established project with proven stability

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 ~163 days

Total

5

Last Release

2203d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/175e90ae6bc9301e411131c43d9a50c241bb37d22ffc806e525c7aa82cb0454d?d=identicon)[harrison-ifeanyichukwu](/maintainers/harrison-ifeanyichukwu)

---

Tags

atom-feed-parserfeed-parserrdf-feed-parserrss-feed-parsersyndicationweb-scraping

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/forensic-feed-parser/health.svg)

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

###  Alternatives

[mck89/peast

Peast is PHP library that generates AST for JavaScript code

19037.7M41](/packages/mck89-peast)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9642.0k](/packages/sauladam-shipment-tracker)[json-mapper/laravel-package

The JsonMapper package for Laravel

25188.9k3](/packages/json-mapper-laravel-package)[moonshine/layouts-field

Field for repeating groups of fields for MoonShine

107.9k](/packages/moonshine-layouts-field)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

112.9k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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