PHP code example of vsevolod-ryzhov / yandex-turbo-rss

1. Go to this page and download the library: Download vsevolod-ryzhov/yandex-turbo-rss 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/ */

    

vsevolod-ryzhov / yandex-turbo-rss example snippets


$feed = new Feed(
    'Feed name',
    'https://<feed url address>',
    'Feed description',
    'Feed language'
);

$feed->setAnalytics(new Analytics('Yandex', '12345'));
$feed->setAnalytics(new Analytics('Google', '54321'));

$feed->setContentPrefix('<div>This content will display before main content</div>');
$feed->setContentSuffix('<footer>This content will display after main content</footer>');

$page1 = new PageItem('First test Page', 'https://eot.company/en', '<p>Test content</p>');
$feed->setPage($page1);

$page2 = new PageItem('Senond test Page', 'https://eot.company/ru', '<header><h1>Title</h1></header><p>Content</p><div><img class="lazyload" src="" data-src="https://eot.company/themes/classic/images/logo-en-black.svg" alt="test" /></div>');
$feed->setPage($page2);

$page2->setContentModifiers(static function ($content) { return str_replace(array('src=""', 'data-src="'), array('', 'src="'), $content); });


$xml = $feed->make(); // this will return XMLWriter object

// to make web Response:
$feed->make()->outputMemory()