Framework-agnostic PHP Feed generator for Laravel, Symfony, and any PHP project. Generate RSS and Atom feeds with full caching support and customizable views.
Framework-agnostic PHP Feed generator for Laravel, Symfony, and any PHP project. Generate RSS and Atom feeds with full caching support and customizable views.
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.
composer require rumenx/php-feedBasic Usage:
…Using Laravel Views (Optional):
For more control, you can use the included Blade templates:
…Basic Usage:
…Using Symfony Views (Optional):
For more control, you can use Twig templates:
…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');# 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// Create feed with simple adapters (recommended for most users)
$feed = FeedFactory::create($config);// 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): selfThis package follows a clean architecture pattern with dependency injection:
FeedCacheInterface: Caching operationsFeedConfigInterface: Configuration accessFeedResponseInterface: HTTP response handlingFeedViewInterface: Template renderingIf you find this project useful, please consider supporting its development: Other ways to support:
We welcome contributions! Please see our Contributing Guide for details.
If you discover any security-related issues, please check our Security Policy.
This package is open-sourced software licensed under the MIT License.
No open issues yet, or sync has not completed.