Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zend Feed Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Note: zendframework/zend-feed is archived and unmaintained; use the actively supported laminas/laminas-feed instead (code-forked and renamed under the Laminas Project).
  • Install via Composer: composer require laminas/laminas-feed (not the original zendframework package for new projects).
  • Start by importing a feed:
    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";
    }
    
  • Podcast-specific feeds: For podcast feeds, leverage the new iTunes extension methods:
    $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
        }
    }
    

Implementation Patterns

  • Consuming feeds:

    • Use 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
          }
      }
      
    • For large feeds, use Reader::importString() with caching (e.g., via PSR-6/PSR-16).
  • Generating feeds:

    • Use 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');
      
    • Deprecation Note: Replace Writer::lcfirst() with PHP’s native lcfirst() function.
  • Integration tips:

    • Cache feeds in HTTP responses using ETags or Cache::save() with PSR-18/PSR-6.
    • In Laravel: Wrap feed generation in a job (for async) and serve via a controller returning a Response with Content-Type: application/rss+xml.
    • Use Reader::getFeedType() to debug feed format detection.

Gotchas and Tips

  • Critical warning: The original zendframework/zend-feed has unpatched security vulnerabilities (last release 2019). Migrate immediately to laminas/laminas-feed.
  • Podcast-specific handling:
    • Use getItunesTitle() (or setItunesTitle() in writer) for <itunes:title> tags. Standard getTitle() will fall back to the default title if iTunes-specific metadata is missing.
    • For advanced podcast features (e.g., enclosures, categories), extend Podcast\Entry or use the ITunes writer extension.
  • Encoding issues: Feed titles/content may contain invalid UTF-8—ensure input strings are clean or use Reader::setEncoding().
  • Timezone quirks: PubDate parsing assumes UTC; compare timestamps with DateTimeImmutable and explicit timezone handling.
  • Pagination: Reader provides a single getEntries() call; for large feeds, use setMaximumItems() or stream via Reader::importFile() with manual chunking.
  • Deprecated classes:
    • Replace AbstractEntry with Entry\AbstractEntry.
    • Replace AbstractFeed with Feed\AbstractFeed.
    • Replace Collection with context-specific collections (e.g., Collection\Author, Collection\Category).
  • Extending: Extend EntryInterface or Podcast\Entry to add custom field parsing (e.g., podcast enclosures) by registering a custom class via Reader::setEntryClassName().
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport