PHPackages                             rumenx/php-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. rumenx/php-feed

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

rumenx/php-feed
===============

Framework-agnostic PHP Feed generator for Laravel, Symfony, and more.

v1.0.2(9mo ago)3665.1k↑139.8%95MITPHPPHP ^8.2CI passing

Since Sep 12Pushed 1w ago17 watchersCompare

[ Source](https://github.com/RumenDamyanov/php-feed)[ Packagist](https://packagist.org/packages/rumenx/php-feed)[ Docs](https://github.com/RumenDamyanov/php-feed)[ GitHub Sponsors](https://github.com/sponsors/RumenDamyanov)[ RSS](/packages/rumenx-php-feed/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (10)Versions (6)Used By (0)

PHP Feed (Framework-Agnostic)
=============================

[](#php-feed-framework-agnostic)

[![CI](https://github.com/RumenDamyanov/php-feed/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/RumenDamyanov/php-feed/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/70dd55d1a313c0b61969e6a0bafcdfda7540debc8c500a5ec39ee26926aea558/68747470733a2f2f636f6465636f762e696f2f67682f52756d656e44616d79616e6f762f7068702d666565642f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/RumenDamyanov/php-feed)[![PHP Version Require](https://camo.githubusercontent.com/d830e81e3f89447709ebdc3f11b69405f043b80e313ede01a15d2c05e4343094/687474703a2f2f706f7365722e707567782e6f72672f72756d656e782f7068702d666565642f726571756972652f706870)](https://packagist.org/packages/rumenx/php-feed)[![Latest Stable Version](https://camo.githubusercontent.com/3e700f7f21544dd060394dcff684e521a2508b3ed6f6ea7b6d6c92d87548a447/687474703a2f2f706f7365722e707567782e6f72672f72756d656e782f7068702d666565642f76)](https://packagist.org/packages/rumenx/php-feed)[![License](https://camo.githubusercontent.com/67676de9809f1f63b9257780defeca5c297e24e0b28f6cf35d2a8cf4cb444609/687474703a2f2f706f7365722e707567782e6f72672f72756d656e782f7068702d666565642f6c6963656e7365)](https://packagist.org/packages/rumenx/php-feed)

A modern, framework-agnostic PHP Feed generator for Laravel, Symfony, and any PHP project. Generate RSS and Atom feeds with full caching support and customizable views.

Features
--------

[](#features)

- 🚀 **Framework Agnostic**: Works with Laravel, Symfony, or any PHP project
- 📡 **Multiple Formats**: RSS 2.0 and Atom 1.0 support
- ⚡ **Caching**: Built-in caching support with framework adapters
- 🎨 **Custom Views**: Use your own templates for feed generation
- 🔧 **Dependency Injection**: Clean architecture with adapter pattern
- ✅ **100% Test Coverage**: Thoroughly tested with Pest
- 📋 **PSR-12 Compliant**: Follows modern PHP standards
- 🔒 **Type Safe**: Full PHP 8.3+ type declarations

Requirements
------------

[](#requirements)

- PHP 8.3+
- Composer

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

[](#installation)

```
composer require rumenx/php-feed
```

Usage Examples
--------------

[](#usage-examples)

### Laravel

[](#laravel)

**Basic Usage:**

```
use Rumenx\Feed\FeedFactory;

class FeedController extends Controller
{
    public function feed()
    {
        $feed = FeedFactory::create();
        $feed->setTitle('My Blog Feed');
        $feed->setDescription('Latest posts from my blog');
        $feed->setLink('https://example.com');

        $feed->addItem([
            'title' => 'First Post',
            'author' => 'Rumen',
            'link' => 'https://example.com/post/1',
            'pubdate' => now(),
            'description' => 'This is the first post.'
        ]);

        // Return XML string directly
        $xml = $feed->render('rss');
        return response($xml, 200, [
            'Content-Type' => 'application/xml'
        ]);
    }
}
```

**Using Laravel Views (Optional):**

For more control, you can use the included Blade templates:

```
use Rumenx\Feed\FeedFactory;

class FeedController extends Controller
{
    public function feed()
    {
        $feed = FeedFactory::create();
        $feed->setTitle('My Blog Feed');
        $feed->addItem([
            'title' => 'First Post',
            'author' => 'Rumen',
            'link' => 'https://example.com/post/1',
            'pubdate' => now(),
            'description' => 'This is the first post.'
        ]);

        // Get data for your own view template
        $items = $feed->getItems();
        $channel = [
            'title' => $feed->getTitle(),
            'description' => $feed->getDescription(),
            'link' => $feed->getLink()
        ];

        return response()->view('feed.rss', compact('items', 'channel'), 200, [
            'Content-Type' => 'application/xml'
        ]);
    }
}
```

### Symfony

[](#symfony)

**Basic Usage:**

```
use Rumenx\Feed\FeedFactory;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;

class FeedController extends AbstractController
{
    public function feed(): Response
    {
        $feed = FeedFactory::create();
        $feed->setTitle('My Blog Feed');
        $feed->setDescription('Latest posts from my blog');
        $feed->setLink('https://example.com');

        $feed->addItem([
            'title' => 'First Post',
            'author' => 'Rumen',
            'link' => 'https://example.com/post/1',
            'pubdate' => new \DateTime(),
            'description' => 'This is the first post.'
        ]);

        // Return XML response
        $xml = $feed->render('atom');
        return new Response($xml, 200, ['Content-Type' => 'application/xml']);
    }
}
```

**Using Symfony Views (Optional):**

For more control, you can use Twig templates:

```
class FeedController extends AbstractController
{
    public function feed(): Response
    {
        $feed = FeedFactory::create();
        $feed->setTitle('My Blog Feed');
        $feed->addItem([
            'title' => 'First Post',
            'author' => 'Rumen',
            'link' => 'https://example.com/post/1',
            'pubdate' => new \DateTime(),
            'description' => 'This is the first post.'
        ]);

        // Get data for your own Twig template
        $items = $feed->getItems();
        $channel = [
            'title' => $feed->getTitle(),
            'description' => $feed->getDescription(),
            'link' => $feed->getLink()
        ];

        return $this->render('feed/atom.xml.twig', [
            'items' => $items,
            'channel' => $channel
        ], new Response('', 200, ['Content-Type' => 'application/xml']));
    }
}
```

### Plain PHP / Other Frameworks

[](#plain-php--other-frameworks)

**Simple Usage (Recommended):**

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

use Rumenx\Feed\FeedFactory;

// Create feed with simple built-in adapters
$feed = FeedFactory::create();
$feed->setTitle('My Feed');
$feed->setDescription('Feed description');
$feed->setLink('https://example.com');

$feed->addItem([
    'title' => 'Hello World',
    'author' => 'Rumen',
    'link' => 'https://example.com/hello',
    'pubdate' => date('c'),
    'description' => 'Hello world post!'
]);

// Output RSS feed
header('Content-Type: application/xml');
echo $feed->render('rss');
```

**Advanced - Custom Adapters:**

You can provide your own implementations for cache, config, response, and view:

```
use Rumenx\Feed\Feed;

$feed = new Feed([
    'cache' => new MyCacheAdapter(),
    'config' => new MyConfigAdapter(),
    'response' => new MyResponseAdapter(),
    'view' => new MyViewAdapter(),
]);

$feed->setTitle('My Feed');
$feed->addItem([
    'title' => 'Hello',
    'author' => 'Rumen',
    'link' => 'https://example.com/hello',
    'pubdate' => date('c'),
    'description' => 'Hello world!'
]);

// Use render() for framework-specific response
// or render() for XML string in plain PHP
echo $feed->render('rss');
```

Development
-----------

[](#development)

### Available Composer Scripts

[](#available-composer-scripts)

```
# Run tests
composer test

# Run tests with coverage
composer test:coverage

# Run tests with HTML coverage report
composer test:coverage-html

# Watch tests (automatically re-run on file changes)
composer test:watch

# Static analysis with PHPStan
composer analyse

# Check code style (PSR-12)
composer style

# Fix code style automatically
composer style:fix

# Run all checks (tests + analysis + style)
composer check

# Run CI checks (coverage + analysis + style)
composer ci
```

API Reference
-------------

[](#api-reference)

### Factory Method

[](#factory-method)

```
// Create feed with simple adapters (recommended for most users)
$feed = FeedFactory::create($config);
```

### Core Methods

[](#core-methods)

```
// Feed configuration
$feed->setTitle(string $title): self
$feed->setDescription(string $description): self
$feed->setLink(string $link): self
$feed->setDateFormat(string $format): self
$feed->setLanguage(string $language): self

// Item management
$feed->addItem(array $item): self
$feed->addItems(array $items): self

// Rendering
$feed->render(string $format = 'rss'): mixed // Returns framework-specific response or XML string

// Caching
$feed->isCached(string $key): bool
$feed->clearCache(string $key): self
```

Architecture
------------

[](#architecture)

This package follows a clean architecture pattern with dependency injection:

- **Feed**: Core feed generator class
- **Adapters**: Framework-specific implementations
    - `FeedCacheInterface`: Caching operations
    - `FeedConfigInterface`: Configuration access
    - `FeedResponseInterface`: HTTP response handling
    - `FeedViewInterface`: Template rendering

Support This Project
--------------------

[](#support-this-project)

If you find this project useful, please consider supporting its development:

[![GitHub Sponsors](https://camo.githubusercontent.com/ebd916e9d223f813dc5737c99f4e55d62d56f87d014c8fa1e8204d87d21e060b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73706f6e736f72732f52756d656e44616d79616e6f763f7374796c653d666f722d7468652d6261646765266c6f676f3d6769746875622d73706f6e736f7273266c6f676f436f6c6f723d7768697465)](https://github.com/sponsors/RumenDamyanov)

Other ways to support:

- ⭐ **Star this repository**
- 🐛 **Report bugs and suggest improvements**
- 💻 **Contribute code or documentation**
- 💖 **Make a donation** - See [FUNDING.md](FUNDING.md) for details

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

[](#contributing)

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please check our [Security Policy](SECURITY.md).

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT License](LICENSE.md).

Links
-----

[](#links)

- [Contributing Guidelines](CONTRIBUTING.md)
- [Security Policy](SECURITY.md)
- [License](LICENSE.md)
- [Changelog](CHANGELOG.md)
- [Funding &amp; Support](FUNDING.md)
- [Issues](https://github.com/RumenDamyanov/php-feed/issues)
- [GitHub Sponsors](.github/FUNDING.yml)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance80

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 73.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 ~28 days

Total

3

Last Release

283d ago

PHP version history (2 changes)v1.0.0-beta2PHP &gt;=8.3

v1.0.2PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/146950137?v=4)[RumenX](/maintainers/RumenX)[@RumenX](https://github.com/RumenX)

---

Top Contributors

[![RumenDamyanov](https://avatars.githubusercontent.com/u/1458253?v=4)](https://github.com/RumenDamyanov "RumenDamyanov (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")

---

Tags

atomcomposerfeedlaravelphprsssymfonyphpsymfonylaravelatomfeedrssgenerator

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rumenx-php-feed/health.svg)

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

###  Alternatives

[suin/php-rss-writer

Yet another simple RSS writer library for PHP 5.4 or later.

2831.4M20](/packages/suin-php-rss-writer)[fkr/simplepie-bundle

Integrates SimplePie into Symfony

11139.0k](/packages/fkr-simplepie-bundle)

PHPackages © 2026

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