dark-chyper/open-feed 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dark-chyper/open-feed

Composer 安装命令:

composer require dark-chyper/open-feed

包简介

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

README 文档

README

A lightweight, framework-agnostic PHP library to generate RSS 2.0 and Atom 1.0 feeds.

Designed to be simple, reliable, and decoupled, OpenFeed separates your data models from the rendering logic, allowing you to switch formats with ease.

Features

  • Multi-format support: RSS 2.0 and Atom 1.0 compliant.
  • Clean Architecture: Data models are format-agnostic.
  • XMLWriter-based: Memory-efficient and safe XML generation.
  • Full Support for:
    • Channel/Feed metadata (Title, Link, Subtitle, ID).
    • Images and Logos.
    • Item enclosures (absolute URLs: http, https, gemini, gopher).
    • Categories (with optional domain/scheme).
    • Authors (Email and Name).
    • Rich HTML content (via CDATA).
  • No framework dependency.
  • Bridges: Native support for Symfony and PSR-7/17.

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.

> Note on Enclosures: For RSS 2.0 compliance, enclosure URLs must be absolute. OpenFeed natively supports http, https, and decentralized protocols like gemini and gopher.

Basic usage

OpenFeed uses a common set of models for both formats.

Generating an Atom Feed

use OpenFeed\AtomFeed;
use OpenFeed\Common\FeedItem;
use OpenFeed\Common\FeedItemAuthor;

$feed = (new AtomFeed())
    ->setTitle('OpenFeed News')
    ->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6')
    ->setLink('[https://example.com](https://example.com)')
    ->setSubtitle('Latest updates from the library');

$item = (new FeedItem())
    ->setTitle('Atom Support Added')
    ->setId('[https://example.com/news/1](https://example.com/news/1)')
    ->setLink('[https://example.com/news/1](https://example.com/news/1)')
    ->setDescription('OpenFeed now supports Atom 1.0!')
    ->setContent('<p>Check out our <strong>new architecture</strong>.</p>')
    ->setAuthor(new FeedItemAuthor('dev@example.com', 'Simon'));

$feed->addItem($item);

echo $feed->render();

Generating an RSS 2.0 Feed

use OpenFeed\RssFeed;
use OpenFeed\Common\FeedItem;

$feed = (new RssFeed())
    ->setTitle('My RSS Feed')
    ->setLink('[https://example.com](https://example.com)')
    ->setDescription('A classic RSS feed')
    ->setTtl(60); // RSS specific method

$item = (new FeedItem())
    ->setTitle('Hello World')
    ->addEnclosure('[https://example.com/audio.mp3](https://example.com/audio.mp3)', 'audio/mpeg', 12345);

$feed->addItem($item);

echo $feed->render();

Sending output

Plain PHP

$feed->render();

The library provides bridges to handle HTTP responses automatically with the correct Content-Type.

Symfony Bridge

use OpenFeed\Bridge\Symfony\FeedResponseFactory;

// Works with RssFeed or AtomFeed
return (new FeedResponseFactory())->toResponse($feed);

PSR-7 (Universal)

Works with any PSR-7/PSR-17 compliant implementation (Slim, Mezzio, Laravel, etc.).

use OpenFeed\Bridge\Psr\PsrFeedResponseFactory;

// Requires PSR-17 factories (e.g. Nyholm/Psr7)
$bridge = new PsrFeedResponseFactory($responseFactory, $streamFactory);

return $bridge->toResponse($feed);

Structure

src/
├── AbstractFeed.php          # Base class for all feeds
├── RssFeed.php               # RSS specific implementation
├── AtomFeed.php              # Atom specific implementation
├── Common/                   # Agnostic data models
│   ├── FeedCategory.php
│   ├── FeedEnclosure.php
│   ├── FeedImage.php
│   ├── FeedItem.php
│   └── FeedItemAuthor.php
├── Bridge/                   # Framework integrations
│   ├── Psr/
│   └── Symfony/
└── Renderer/                 # Format-specific rendering logic
    ├── FeedRendererInterface.php
    ├── Rss20Renderer.php
    └── AtomRenderer.php

Philosophy

OpenFeed focuses on:

  • simplicity over abstraction
  • correctness over magic
  • portability across projects

Roadmap

  • [X] Atom renderer
  • [X] Categories support
  • [X] Author support
  • [ ] Cache headers helpers

License

This project is licensed under the GNU Lesser General Public License v3.0 or later.

See the LICENSE and COPYING.LESSER files for more details.

dark-chyper/open-feed 适用场景与选型建议

dark-chyper/open-feed 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「xml」 「atom」 「feed」 「rss」 「Syndication」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dark-chyper/open-feed 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dark-chyper/open-feed 我们能提供哪些服务?
定制开发 / 二次开发

基于 dark-chyper/open-feed 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-03