zendframework/zend-feed
Abandoned Zend Framework package for consuming and generating RSS and Atom feeds, with a natural API for reading/modifying feed and entry elements and rendering back to XML. Moved to laminas/laminas-feed.
zendframework/zend-feed is archived and unmaintained; use the actively supported laminas/laminas-feed instead (code-forked and renamed under the Laminas Project).composer require laminas/laminas-feed (not the original zendframework package for new projects).use Laminas\Feed\Reader\Reader;
$feed = Reader::import('https://example.com/feed.xml');
echo $feed->getTitle(); // e.g., "Example Blog"
foreach ($feed as $item) {
echo $item->getTitle() . "\n";
}
$podcastFeed = Reader::import('https://example.com/podcast.xml');
foreach ($podcastFeed as $episode) {
echo $episode->getTitle(); // Works for both standard titles and <itunes:title>
if ($episode instanceof \Laminas\Feed\Reader\Extension\Podcast\Entry) {
echo $episode->getItunesTitle(); // Explicit iTunes title access
}
}
Consuming feeds:
Reader::import() for RSS/Atom feeds (auto-detects format). For podcasts, check for Podcast\Entry instances:
$feed = Reader::import('https://example.com/podcast.xml');
foreach ($feed as $entry) {
if ($entry instanceof \Laminas\Feed\Reader\Extension\Podcast\Entry) {
// Handle podcast-specific metadata
}
}
Reader::importString() with caching (e.g., via PSR-6/PSR-16).Generating feeds:
Laminas\Feed\Writer\Feed to programmatically build RSS/Atom feeds. For podcasts, extend with iTunes-specific fields:
use Laminas\Feed\Writer\Feed;
use Laminas\Feed\Writer\Extension\ITunes;
$feed = new Feed();
$feed->setTitle('My Podcast')
->setLink('https://example.com');
$entry = $feed->addEntry([
'title' => 'Episode 1',
'link' => 'https://example.com/episode/1',
]);
$entry->setItunesTitle('Episode 1: Introduction'); // iTunes-specific title
$entry->setItunesDuration('00:15:00');
echo $feed->export('rss');
Writer::lcfirst() with PHP’s native lcfirst() function.Integration tips:
Cache::save() with PSR-18/PSR-6.Response with Content-Type: application/rss+xml.Reader::getFeedType() to debug feed format detection.zendframework/zend-feed has unpatched security vulnerabilities (last release 2019). Migrate immediately to laminas/laminas-feed.getItunesTitle() (or setItunesTitle() in writer) for <itunes:title> tags. Standard getTitle() will fall back to the default title if iTunes-specific metadata is missing.Podcast\Entry or use the ITunes writer extension.Reader::setEncoding().DateTimeImmutable and explicit timezone handling.Reader provides a single getEntries() call; for large feeds, use setMaximumItems() or stream via Reader::importFile() with manual chunking.AbstractEntry with Entry\AbstractEntry.AbstractFeed with Feed\AbstractFeed.Collection with context-specific collections (e.g., Collection\Author, Collection\Category).EntryInterface or Podcast\Entry to add custom field parsing (e.g., podcast enclosures) by registering a custom class via Reader::setEntryClassName().How can I help you explore Laravel packages today?