PHP code example of lukaswhite / podcast-feed-validator

1. Go to this page and download the library: Download lukaswhite/podcast-feed-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lukaswhite / podcast-feed-validator example snippets


use Lukaswhite\PodcastFeedValidator\Validator;

$validator = new Validator();

$validator->load('/path/to/feed.rss');
// or
$validator->setContent(/** raw content */);

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

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

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

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

$result->hasErrors();

$result->hasWarnings();
$result->hasWarning(Warning::NO_LANGUAGE);
$result->hasWarning(Warning::NO_ARTWORK);
$result->hasWarning(Warning::NO_CATEGORIES);
$result->hasWarning(Warning::NO_EXPLICIT);

$result->hasRecommendations();
$result->hasRecommendation(Recommendation::ADD_AUTHOR);
$result->hasRecommendation(Recommendation::ADD_OWNER);

$result = $validator->run()->episodes()[0];
$result->hasWarning(Warning::NO_MEDIA);
$result->hasRecommendation(Recommendation::ADD_LINK);
$result->hasRecommendation(Recommendation::ADD_GUID);
$result->hasRecommendation(Recommendation::ADD_PUB_DATE);
$result->hasRecommendation(Recommendation::ADD_DESCRIPTION);
$result->hasRecommendation(Recommendation::ADD_EXPLICIT);
$result->hasRecommendation(Recommendation::ADD_ARTWORK);
$result->hasRecommendation(Recommendation::ADD_DURATION);