dark-chyper/open-feed

A lightweight, framework-agnostic PHP library to generate RSS feeds with XMLWriter

Maintainers

Package info

gitlab.com/DarkChyper/open-feed

Issues

pkg:composer/dark-chyper/open-feed

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

v0.0.1 2026-04-03 18:22 UTC

This package is auto-updated.

Last update: 2026-04-03 16:29:25 UTC


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).