PHP code example of sylapi / feed-compari

1. Go to this page and download the library: Download sylapi/feed-compari 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/ */

    

sylapi / feed-compari example snippets


$feedGenerator = new Sylapi\Feeds\FeedGenerator();
$feedGenerator->setFeed(new Sylapi\Feeds\Compari\Feed(
    Sylapi\Feeds\Parameters::create([
        'title' => 'Title example',
        'description' => 'Description example...',
        'link' => 'https://link.example/',
    ])
));

$product = new \Sylapi\Feeds\Models\Product();
//...
$feedGenerator->appendProduct($product);
$feedGenerator->appendProduct($product);
//...
$feedGenerator->appendProduct($product);
//...
$feedGenerator->save();
echo $feedGenerator->filePath();