Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mehedimi/feed-reader

A simple rss and atom feed reader
https://github.com/mehedimi/feed-reader

atom atom-feed feed laravel-rss-feed rss rss-feed rss-feed-scraper

Last synced: about 1 month ago
JSON representation

A simple rss and atom feed reader

Awesome Lists containing this project

README

        

# Feed Reader
A simple feed reader
## Installation
```bash
$ composer require mehedimi/feed-reader
```
## Basic Uses:

```php
rss('http://your-url.com/rss')
->read();

echo $rss->getTitle(); // Get the channel title

// Access channel extra field
echo $rss->channel()->extra;

foreach ($rss->items() as $item) {
echo $item->title; // Get the item title
// Accessing attribute
echo $item->title->attributes()->attributeName;
}

// Reading Atom Feed

$atom = $feed->atom('http://your-url.com/atom')
->read();

echo $atom->getTitle(); // Title
echo $atom->getUpdated()->format('d F, Y'); // Last Updated Date

// Access channel extra field
echo $atom->feed()->extra;

foreach ($atom->entries() as $entry) {
echo $entry->title; // Get the item title
// Accessing attribute
echo $entry->title->attributes()->attributeName;
}
```

## Authentication

If your feed resource are protected by HTTP Basic Auth then you can use `basicAuth`
```php
rss('url')
->basicAuth('username', 'password')
->read();
// OR
$feed->atom('url')
->basicAuth('username', 'password')
->read();
```

## With Laravel

```php
read();

```