SimplePie is a PHP library that retrieves and parses RSS and Atom feeds. The core workflow is straightforward: verify the runtime requirements, point a SimplePie instance at a feed, initialize it, and read feed- and item-level accessors. Production code must also make deliberate choices about caching, raw feed input, multiple feeds, HTTP clients, and the project’s limited maintenance cadence.
What SimplePie does
SimplePie handles feed retrieval and parsing so your application can work with titles, descriptions, authors, dates, links, and entries without implementing RSS and Atom parsing itself. It is open-source software under the BSD-3-Clause license, not a hosted feed service or a product you need to purchase.
The project README says, “SimplePie is currently maintained by Malcolm Blaney.” It also describes maintenance as sporadic and warns that older versions do not receive active bug or security fixes. Treat the installed version and its current source as authoritative rather than assuming that a legacy tutorial reflects every release.
Check requirements before installation
The current master branch README lists PHP 7.2 or newer. It also requires libxml2, PCRE, a character-encoding extension (one of iconv, mbstring, or intl), and either cURL or fsockopen(). Internationalized-domain-name support can additionally depend on intl, symfony/polyfill-intl-idn, or cURL built with IDN support.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
- Confirm the PHP version used by the web process or worker, not only the version in your shell.
- Enable the XML, encoding, networking, and regex capabilities listed above.
- Do not infer that an older PHP branch or old SimplePie release still receives security fixes.
The package contains source classes, an autoloader, tests, a demo, and build scripts. Since version 1.3, classes are split across files; a compiled monolithic file can be generated or obtained from releases. Use the distribution format appropriate for your deployment and verify the installed version before copying code from older documentation.
Parse one remote feed
The basic API pattern is to include the library autoloader, create an instance, set a feed URL, initialize it, and read accessors. A minimal implementation looks like this:
<?php
require_once __DIR__ . '/path/to/simplepie/autoloader.php';
$feed = new SimplePie();
$feed->set_feed_url('https://example.com/feed.xml');
$feed->init();
$title = $feed->get_title();
$description = $feed->get_description();
$items = $feed->get_items();
foreach ($items as $item) {
echo '<article>';
echo '<h2>' . htmlspecialchars($item->get_title(), ENT_QUOTES, 'UTF-8') . '</h2>';
echo '<p>' . htmlspecialchars($item->get_description(), ENT_QUOTES, 'UTF-8') . '</p>';
echo '</article>';
}
The official sample also calls handle_content_type() so SimplePie can emit an appropriate response content type. That sample is legacy documentation: use it to understand the API shape, then check method signatures and defaults in the version actually installed.
set_feed_url() accepts a feed location. Documentation says SimplePie attempts autodiscovery when the supplied location is not itself a feed, unless autodiscovery has been disabled. In an application, validate and constrain user-supplied URLs before fetching them; a feed reader should not become an unrestricted server-side request proxy.
Rank #2
Read the feed and item data you actually need
Feed-level accessors expose metadata such as the title, description, author, and encoding. get_items() returns item objects that provide entry-level fields, including titles, descriptions, links, authors, and dates. Configure output encoding, URL handling, sanitization, timeouts, and item limits to match the page or API you are building rather than rendering every available field by default.
- Escape text when inserting it into HTML, as in the example.
- Apply an item limit when a feed can contain a large archive.
- Set a finite network timeout and handle an unavailable or malformed feed as an application error.
- Decide whether descriptions should be rendered as trusted HTML or reduced to safe text; feed content is external input.
Use an already-loaded XML string
If another component has already downloaded the RSS or Atom document, pass the content with set_raw_data() instead of giving SimplePie a URL:
$feed = new SimplePie();
$feed->set_raw_data($xmlString);
$feed->init();
$items = $feed->get_items();
Raw-data input does not use SimplePie’s cache. Your application must cache the string itself if repeated parsing or retrieval should be avoided. This makes raw input useful when an existing HTTP pipeline, queue, or storage layer already owns downloading, but it also transfers freshness, expiry, and failure handling to that layer.
How SimplePie caching works
SimplePie supports cache configuration and, in versions that provide it, PSR-16 cache implementations. The legacy FAQ documents a 60-minute default cache duration; because defaults can change, verify the value in your installed version or configuration.
- On a request with a fresh cached entry, SimplePie reuses the cached feed.
- After expiry, it can make a conditional request to ask whether the remote feed changed.
- If the server confirms that the content is unchanged, the cached copy is renewed.
- If the feed changed, SimplePie downloads and parses the new content.
Conditional retrieval only saves bandwidth when the feed server supports the relevant HTTP behavior. It is not a guarantee that every refresh avoids a full download.
The legacy file-cache API uses a filesystem directory. That directory must be writable by the web server or worker account; the project’s demo instructions make the same requirement for its cache folder. A permission failure can look like repeated downloads or initialization errors, so check ownership, mode, and the process user when diagnosing cache problems.
| Input or cache choice | Who controls retrieval | Important trade-off |
|---|---|---|
| Feed URL with SimplePie cache | SimplePie | Convenient refresh behavior; cache location and permissions still need configuration. |
Raw XML via set_raw_data() |
Your application | Works with an existing downloader or queue, but SimplePie does not cache the raw input. |
| PSR-16 cache integration | Your PSR-16 implementation | Fits an application-wide cache, provided the installed SimplePie version supports the integration. |
Consume several feeds without relying on a stale multifeed example
Older documentation shows passing an array of URLs to one SimplePie object. Current master source deprecates that pattern as of 1.9.0. The documented approach is one instance per feed, followed by SimplePie::merge_items() when you need a combined list.
$feeds = [];
foreach ($urls as $url) {
$feed = new SimplePie();
$feed->set_feed_url($url);
$feed->init();
$feeds[] = $feed;
}
$items = SimplePie::merge_items($feeds);
Each additional feed consumes processing time and other resources. Fetch only the feeds needed for the page, cache each feed appropriately, and impose item and timeout limits. If your installed release differs from current master, confirm the exact merge method and deprecation status in that release’s API.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #4
Plug in standard HTTP and cache components when appropriate
The project documents optional PSR-18 HTTP-client support with PSR-17 request and URI factories since 1.9.0, and PSR-16 cache support since 1.8.0. These integrations are useful when the surrounding application already standardizes HTTP requests or caching. They are not prerequisites for the basic URL-based flow, and availability depends on the SimplePie version you install.
| Integration | Use it when | What it changes |
|---|---|---|
| Built-in fetching | You need a simple standalone reader. | Fewer application dependencies; SimplePie owns the request path. |
| PSR-18 client | Your application already has a standard HTTP client, policies, or transport. | HTTP behavior can be centralized, subject to version support and factory wiring. |
| Built-in/file cache | A local filesystem cache is sufficient. | Simple deployment, but the cache directory must be writable. |
| PSR-16 cache | You share Redis, Memcached, or another application cache. | Centralized cache operations, with configuration responsibility in your application. |
Troubleshoot the common failure modes
Initialization fails immediately
Check that the autoloader path is correct, the PHP process meets the documented version and extension requirements, and the feed URL is reachable from the server. A URL that works in your browser may be blocked or unavailable from the hosting environment.
Every request downloads the feed
Verify that caching is enabled, the configured directory exists, and the process user can write there. With raw XML, implement caching outside SimplePie because raw-data parsing bypasses its cache.
Old multifeed code emits deprecation warnings
Move to one instance per URL and combine the resulting instances with SimplePie::merge_items(), then confirm the syntax against your installed release.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteOutput contains unsafe or broken markup
Treat titles and descriptions as untrusted feed content. Escape text for the output context, configure sanitization, and avoid assuming that an item’s HTML is safe merely because it came from an RSS or Atom document.
Keep version and support expectations realistic
The official wiki and API index are old; the API index identifies itself as 1.2 documentation. They remain useful for understanding historical examples and question wording, but they should not override the current repository, source, or the version installed in your application. The project states that development occurs on the master branch while maintenance is sporadic, and it does not promise a release cadence or support service level. Pin and test the version you deploy, monitor security advisories and upstream changes, and avoid assuming that legacy examples are drop-in code.
The Bottom Line
For a dependable SimplePie integration, use a current, verified package; satisfy its PHP and extension requirements; initialize one feed at a time; cache URL-based retrieval; manage caching yourself for raw XML; and update old multifeed examples to separate instances plus merge_items(). Treat feed data as untrusted input and the project’s sporadic maintenance as an operational constraint.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




