PHPackages                             isaacongoma/laravel-feed - 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. isaacongoma/laravel-feed

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

isaacongoma/laravel-feed
========================

Generate rss feeds

3.1.3(5y ago)07MITPHPPHP ^7.4|^8.0

Since Mar 5Pushed 5y agoCompare

[ Source](https://github.com/isaacongoma/laravel-feed)[ Packagist](https://packagist.org/packages/isaacongoma/laravel-feed)[ Docs](https://github.com/spatie/laravel-feed)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/isaacongoma-laravel-feed/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (8)Versions (48)Used By (0)

Generate RSS feeds in a Laravel app
===================================

[](#generate-rss-feeds-in-a-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0a77ac44e3568d43658ab20238e31c40d84fb14d38d65f5cc8ec2acbf57b1bfe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d666565642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-feed)[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Workflow Status](https://camo.githubusercontent.com/84f58da99386c84bba9da9f16287c6ea72a071da7117899aeff0cbe86cbdd6e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d666565642f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/84f58da99386c84bba9da9f16287c6ea72a071da7117899aeff0cbe86cbdd6e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d666565642f72756e2d74657374733f6c6162656c3d7465737473)[![Total Downloads](https://camo.githubusercontent.com/55ef5cc80e393fb1a2123d63c959801663a9a333e62effd1157d767c51d6cabe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d666565642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-feed)

This package provides an easy way to generate [RSS feeds](http://www.whatisrss.com/). There's almost no coding required on your part. Just follow the installation instructions update your config file and you're good to go.

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/65ab01facc8411215c460177ea5eaf7a1265b7b9e38f74c6a7c7cb177aae705f/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d666565642e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-feed)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#installation)

You can install the package via composer:

```
composer require spatie/laravel-feed
```

Register the routes the feeds will be displayed on using the `feeds`-macro.

```
// In routes/web.php
Route::feeds();
```

You can pass a string as a first argument of the macro. The string will be used as a url prefix for your feed.

Next, you must publish the config file:

```
php artisan vendor:publish --provider="Spatie\Feed\FeedServiceProvider" --tag="config"
```

Here's what that looks like:

```
return [
    'feeds' => [
        'main' => [
            /*
             * Here you can specify which class and method will return
             * the items that should appear in the feed. For example:
             * 'App\Model@getAllFeedItems'
             *
             * You can also pass an argument to that method:
             * ['App\Model@getAllFeedItems', 'argument']
             */
            'items' => '',

            /*
             * The feed will be available on this url.
             */
            'url' => '',

            'title' => 'My feed',
            'description' => 'The description of the feed.',
            'language' => 'en-US',

            /*
             * The view that will render the feed.
             */
            'view' => 'feed::feed',
        ],
    ],
];
```

Optionally you can publish the view files:

```
php artisan vendor:publish --provider="Spatie\Feed\FeedServiceProvider" --tag="views"
```

Usage
-----

[](#usage)

Imagine you have a model named `NewsItem` that contains records that you want to have displayed in the feed.

First you must implement the `Feedable` interface on that model. `Feedable` expects one method: `toFeedItem`, which should return a `FeedItem` instance.

```
// app/NewsItem.php

use Illuminate\Database\Eloquent\Model;
use Spatie\Feed\Feedable;
use Spatie\Feed\FeedItem;

class NewsItem extends Model implements Feedable
{
    public function toFeedItem(): FeedItem
    {
        return FeedItem::create()
            ->id($this->id)
            ->title($this->title)
            ->summary($this->summary)
            ->updated($this->updated_at)
            ->link($this->link)
            ->author($this->author);
    }
}
```

If you prefer, returning an associative array with the necessary keys will do the trick too.

```
// app/NewsItem.php

use Illuminate\Database\Eloquent\Model;
use Spatie\Feed\Feedable;
use Spatie\Feed\FeedItem;

class NewsItem extends Model implements Feedable
{
    public function toFeedItem(): FeedItem
    {
        return FeedItem::create([
            'id' => $this->id,
            'title' => $this->title,
            'summary' => $this->summary,
            'updated' => $this->updated_at,
            'link' => $this->link,
            'author' => $this->author,
        ]);
    }
}
```

Next, you'll have to create a method that will return all the items that must be displayed in the feed. You can name that method anything you like and you can do any query you want.

```
// app/NewsItem.php

public static function getFeedItems()
{
   return NewsItem::all();
}
```

Finally, you have to put the name of your class and the url where you want the feed to rendered in the config file:

```
// config/feed.php

return [

    'feeds' => [
        'news' => [
            /*
             * Here you can specify which class and method will return
             * the items that should appear in the feed. For example:
             * '\App\Model@getAllFeedItems'
             */
            'items' => 'App\NewsItem@getFeedItems',

            /*
             * The feed will be available on this url.
             */
            'url' => '/feed',

            'title' => 'All newsitems on mysite.com',

            /*
             * Custom view for the items.
             *
             * Defaults to feed::feed if not present.
             */
            'view' => 'feed::feed',
        ],
    ],

];
```

The `items` key must point to a method that returns one of the following:

- An array or collection of `Feedable`s
- An array or collection of `FeedItem`s
- An array or collection of arrays containing feed item values

### Customizing your feed views

[](#customizing-your-feed-views)

This package provides, out of the box, the `feed::feed` view that displays your feeds details.

However, you could use a custom view per feed by providing a `view` key inside of your feed configuration.

In the following example, we're using the previous `News` feed with a custom `feeds.news` view (located on `resources/views/feeds/news.blade.php`):

```
// config/feed.php

return [

    'feeds' => [
        'news' => [
            'items' => 'App\NewsItem@getFeedItems',

            'url' => '/feed',

            'title' => 'All newsitems on mysite.com',

            /*
             * Custom view for the items.
             *
             * Defaults to feed::feed if not present.
             */
            'view' => 'feeds.news',
        ],
    ],

];
```

### Automatically generate feed links

[](#automatically-generate-feed-links)

To discover a feed, feed readers are looking for a tag in the head section of your html documents that looks like this:

```

```

You can add this to your `` through a partial view.

```
 @include('feed::links')
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [Jolita Grazyte](https://github.com/JolitaGrazyte)
- [Freek Van der Herten](https://github.com/freekmurze)
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 64.1% 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 ~41 days

Total

45

Last Release

1938d ago

Major Versions

1.4.1 → 2.0.02017-08-30

2.7.1 → 3.0.02020-09-08

PHP version history (6 changes)1.0.0PHP ^7.0

2.1.2PHP ^7.1

2.2.0PHP ^7.2

2.7.1PHP ^7.3

3.0.0PHP ^7.4

3.1.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21239787?v=4)[Isaac Ongoma](/maintainers/isaacongoma)[@isaacongoma](https://github.com/isaacongoma)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (166 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (41 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (11 commits)")[![isaacongoma](https://avatars.githubusercontent.com/u/21239787?v=4)](https://github.com/isaacongoma "isaacongoma (7 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (4 commits)")[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (4 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (3 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![king724](https://avatars.githubusercontent.com/u/350488?v=4)](https://github.com/king724 "king724 (1 commits)")[![leedriscoll](https://avatars.githubusercontent.com/u/940369?v=4)](https://github.com/leedriscoll "leedriscoll (1 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (1 commits)")[![nikhiltri](https://avatars.githubusercontent.com/u/1613175?v=4)](https://github.com/nikhiltri "nikhiltri (1 commits)")[![olipayne](https://avatars.githubusercontent.com/u/1346672?v=4)](https://github.com/olipayne "olipayne (1 commits)")[![Pascal-So](https://avatars.githubusercontent.com/u/18399125?v=4)](https://github.com/Pascal-So "Pascal-So (1 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (1 commits)")[![pkboom](https://avatars.githubusercontent.com/u/13960169?v=4)](https://github.com/pkboom "pkboom (1 commits)")[![renatofmachado](https://avatars.githubusercontent.com/u/4793869?v=4)](https://github.com/renatofmachado "renatofmachado (1 commits)")[![vdbelt](https://avatars.githubusercontent.com/u/11087503?v=4)](https://github.com/vdbelt "vdbelt (1 commits)")[![zachleigh](https://avatars.githubusercontent.com/u/5616626?v=4)](https://github.com/zachleigh "zachleigh (1 commits)")

---

Tags

spatielaravelrsslaravel-feed

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/isaacongoma-laravel-feed/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M149](/packages/laravel-mcp)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

815320.5k3](/packages/defstudio-telegraph)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

44855.7k](/packages/harris21-laravel-fuse)[api-platform/laravel

API Platform support for Laravel

58170.8k13](/packages/api-platform-laravel)

PHPackages © 2026

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