A PHP library for validating podcast feeds

1.1 2022-07-26 14:02 UTC

This package is auto-updated.

Last update: 2024-02-26 17:30:22 UTC


A PHP library for validating podcast feeds.

Checks the validity of the feed; for example whether it's XML, RSS, whether it has the appropriate namespace.

It warns if certain fields are missing; for example, the fields that iTunes requires.

It also recommends fields that iTunes recommend, but which are not required.

Note that I deliberately haven't added a method to fetch a remote feed, so as not to add additional dependencies; I'd recommend using Guzzle.


composer require lukaswhite/podcast-feed-validator


use Lukaswhite\PodcastFeedValidator\Validator;

$validator = new Validator();

// or
$validator->setContent(/** raw content */);

$result = $validator->run();
if ($result->fails()) {
    // something

The Result

The return value is an object that encapsulates the errors, warnings and recommendations.

Each of these are just strings, and are defined as constants in the relevant classes.

Note that typically, if an error has occurred then validation has failed before it starts generating warnings or recommendations. For example if the provided feed isn't XML, then it cannot check for the existence of certain fields.

if ($result->hasErrors()) {
    foreach ($result->getErrors() as $error) {

if ($result->hasWarnings()) {
    foreach ($result->getWarnings() as $error) {

if ($result->hasRecommendations()) {
    foreach ($result->getRecommendations() as $error) {

The result object also includes individual results for the episodes.


Suppose you provide the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	<title>Minimal Example</title>
	<description>Just an example.</description>
		<title>Episode One</title>

This will return FALSE:


The following will all return TRUE:


It will also make recommendations, so the following will also return TRUE:


For the episode:

$result = $validator->run()->episodes()[0];

See the tests for more information.