PHP Packagev8.5.xMIT License785+ downloads

Rss: RSS feeds that never break

PHP Rss turns a few chained method calls into a valid, specification-ordered RSS 2.0 document. It validates every value before writing, so you never publish a feed that readers reject. It needs nothing beyond ext-xmlwriter and works in any PHP 8 app, framework, or build script.

$composer require pharaonic/php-rss
Key Features

Everything you need to publish a feed

Build the channel, add items, call `toXml()`. That's the whole workflow.

Fluent Builder

Every RSS 2.0 channel and item element is one chained method on Feed or Item.

Always Well-Formed

Invalid UTF-8, XML control characters, and ]]> in CDATA are caught before they break your feed.

Built-in Namespaces

Atom self links, content:encoded, dc:creator, and Media RSS, declared once on the root.

Custom Extensions

Implement the small Extension contract to add iTunes, GeoRSS, or any namespace you need.

Podcasts and Video

Enclosures, media:content, thumbnails, durations, and bitrates for media feeds.

Correct Dates

Any DateTimeInterface is written as RFC 822 with its own timezone, never the server's.

A quick look

A complete blog feed with an Atom self link, ready to serve.

public/rss.php
1$feed = Feed::make()
2 ->title('Pharaonic Blog')
3 ->link('https://pharaonic.dev/blog')
4 ->description('News & releases from the Pharaonic team.')
5 ->extension(Link::self('https://pharaonic.dev/rss.xml'));
6 
7foreach ($posts as $post) {
8 $feed->addItem(Item::make()
9 ->title($post->title)
10 ->link($post->url)
11 ->guid($post->url)
12 ->publishedAt($post->publishedAt));
13}
14 
15echo $feed->toXml();
FAQ

Rss Questions

Quick answers about installing and using Rss.

What is Rss?

A lightweight, dependency-free RSS 2.0 feed generator for PHP 8, with a fluent API, strict validation, and built-in Atom, Content, Dublin Core, and Media RSS extensions. It's a free, open-source PHP package by Pharaonic.

How do I install Rss?

Run composer require pharaonic/php-rss in your project's root directory.

What does Rss require?

The latest release requires PHP 8.5+.

Does it work with Laravel, Symfony, or plain PHP?

Yes. It's a framework-agnostic PHP library with no service provider or configuration. toXml() returns a string that you can return from any controller, response object, or script.

Does it send HTTP headers?

No. The package never calls header() or prints anything. Send Content-Type: application/rss+xml; charset=UTF-8 from your application.

Can I build podcast feeds or add namespaces like iTunes?

Yes. Use enclosures and the built-in Media RSS extension for podcasts, and implement the Extension contract to add any other namespace, such as iTunes or GeoRSS.

Is Rss free to use?

Yes. Rss is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Rss documentation?

Read the Rss documentation for setup, configuration, and usage examples.

How do I report a bug or contribute to Rss?

Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.

Ready to dig in?

Read the full documentation for installation, channel and item elements, the Atom, Content, Dublin Core, and Media RSS extensions, writing your own extensions, validation, the API reference, and real-world examples.