PHPackages                             pqrs/checkrss - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pqrs/checkrss

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pqrs/checkrss
=============

Check rss feeds for new items

017PHP

Since Feb 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pqrs/checkrss)[ Packagist](https://packagist.org/packages/pqrs/checkrss)[ RSS](/packages/pqrs-checkrss/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

CheckRSS
========

[](#checkrss)

Check RSS feeds for new items

CheckRSS provides some methods to:

- Get all the items in a RSS feed
- Check which of those items is/are new since last check
- Write a log every time a checking for new items is run

It is recommended using CheckRSS with a cron job so you can get new items periodically, although you can run it manually too.

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

[](#installation)

```
composer require pqrs/checkrss=dev-master

```

Alternatively, add the dependency directly to your composer.json file:

```
"require": {
    "pqrs/checkrss": "dev-master"
}

```

Then add to your php code:

```
require_once __DIR__ . '/vendor/autoload.php';   // Autoload files using Composer autoload

use CheckRSS\RSS;
```

Usage
-----

[](#usage)

### method getItems($feed\_url)

[](#method-getitemsfeed_url)

This method gets **all the items** published in the rss feed and returns an object containing them.

```
$rss = new RSS;

$items = $rss->getItems("http://feeds.nbcnews.com/feeds/topstories");
```

An example of the object returned would be:

```
SimpleXMLElement Object
(
    [guid] => https://www.nbcnews.com/storyline/hurricane-irma/...
    [title] => One-two punch of disease and Irma has left Florida citrus reeling
    [pubDate] => Sat, 10 Feb 2018 15:17:00 GMT
    [link] => https://www.nbcnews.com/storyline/hurricane-irma/...
    [description] => Hurricane Irma served as a knockout punch for many of Florida's...
)

```

### method getNewItems($items)

[](#method-getnewitemsitems)

This method checks which items in a feed (obtained with getItems) are new since the last a check was made.

Returns an object with just the **new items**.

```
$rss = new RSS;

// Gets all the items published in the rss feed and stores them in $items
$items = $rss->getItems("http://feeds.nbcnews.com/feeds/topstories");

// Checks which items are new since last check
if ($newitems = $rss->getNewItems($items) ) {

    // Prints new items
    echo "New items found:" . PHP_EOL . PHP_EOL;

    foreach ($newitems as $value) {

        echo $value->title          . PHP_EOL;
        echo $value->description    . PHP_EOL;
        echo $value->guid           . PHP_EOL;
        echo $value->link           . PHP_EOL. PHP_EOL;

    }

} else {

    echo "There'are no new items in RSS feed";

}
```

### method storeLastItemID($item\_id)

[](#method-storelastitemiditem_id)

**Internal use**. This method writes the last read item id in a file to compare it in future checks.

### method isNewItem($item\_id)

[](#method-isnewitemitem_id)

**Internal use**. This method compares the last read item id with the last stored one in previous check.

### method WriteLog($logline)

[](#method-writeloglogline)

A simple method to write a log file everytime a check is made.

Examples
--------

[](#examples)

You can find some uses for these functions in [tests folder](tests).

Prerequisites
-------------

[](#prerequisites)

PHP 5.3.0

Contributing
------------

[](#contributing)

Contributions are of course very welcome!

Credits
-------

[](#credits)

**Copyright © 2018 Alvaro Piqueras** - [pqrs](https://github.com/pqrs)

This is a cleanup of a dirty code I wrote some time ago. Also it's my first try with GitHub, Composer and Packagist so if you find some mistakes or have some tips for me, I would be more than glad to hear you.

I hope this code suites your needs.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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://avatars.githubusercontent.com/u/1423685?v=4)[alvaro](/maintainers/pqrs)[@pqrs](https://github.com/pqrs)

---

Tags

phprssrss-feed

### Embed Badge

![Health badge](/badges/pqrs-checkrss/health.svg)

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

###  Alternatives

[webflo/drupal-finder

Helper class to locate a Drupal installation.

12653.2M218](/packages/webflo-drupal-finder)[rankmath/seo-by-rank-math

Rank Math is the most powerful way to get BEST WordPress SEO tools added to your website.

1252.0k](/packages/rankmath-seo-by-rank-math)[thiktak/filament-nested-builder-form

Plugin for FilamentPHP - Nested Builder Form Component

208.6k1](/packages/thiktak-filament-nested-builder-form)[thiktak/filament-simple-list-entry

Simple List Entry for Infolist

223.9k](/packages/thiktak-filament-simple-list-entry)[radialapps/banner-warn

Show avatars in roundcube message list with warnings

131.0k](/packages/radialapps-banner-warn)

PHPackages © 2026

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