dark-chyper / open-feed
A lightweight, framework-agnostic PHP library to generate RSS feeds with XMLWriter
v0.0.1
2026-04-03 18:22 UTC
Requires
- php: >=8.2
- ext-xmlwriter: *
Requires (Dev)
- ext-dom: *
- friendsofphp/php-cs-fixer: ^3.94
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.0
- symfony/http-foundation: ^6.0 || ^7.0
Suggests
- symfony/http-foundation: Required for Symfony integration (FeedResponseFactory)
README
A lightweight, framework-agnostic PHP library to generate RSS 2.0 feeds using XMLWriter.
Designed to be simple, reliable, and reusable across multiple projects.
Features
- RSS 2.0 compliant
- XMLWriter-based (safe XML generation)
- Support for:
- channel image
- item enclosure (images, media)
- content:encoded (HTML content)
- CDATA handling
- No framework dependency
- Optional Symfony bridge
Installation
composer require dark-chyper/open-feed
Note on Dates: It is highly recommended to provide dates in UTC. The library automatically formats them to RFC 2822 for RSS compliance.
Basic usage
use OpenFeed\Feed;
use OpenFeed\FeedItem;
$feed = (new Feed())
->setTitle('Open Tempo')
->setDescription('Couleur EDF Tempo chaque jour')
->setLink('https://tempo.lhoir.me/')
->setAtomLink('https://tempo.lhoir.me/feed.xml');
$item = (new FeedItem())
->setTitle('Tempo du jour')
->setLink('https://tempo.lhoir.me/')
->setGuid('tempo-day-2026-03-20')
->setDescription('Jour bleu Tempo.')
->addEnclosure(
'https://tempo.lhoir.me/assets/tempo.png',
'image/png',
12345
);
$feed->addItem($item);
echo $feed->render();
HTML content
You can embed full HTML content using content:encoded:
$item->setContentEncoded('<p>Hello <strong>world</strong></p>');
Sending output
Plain PHP
$feed->send();
Symfony
use OpenFeed\Bridge\Symfony\FeedResponseFactory;
return (new FeedResponseFactory())->toResponse($feed);
Structure
src/
├── Feed.php
├── FeedItem.php
├── FeedEnclosure.php
├── FeedImage.php
└── Bridge/
└── Symfony/
└── FeedResponseFactory.php
Philosophy
OpenFeed focuses on:
- simplicity over abstraction
- correctness over magic
- portability across projects
Roadmap
- [ ] Categories support
- [ ] Author support
- [ ] Atom renderer
- [ ] Cache headers helpers
License
This project is licensed under the GNU GPL v3 (or later).