1. Go to this page and download the library: Download fabricio872/easy-rss-bundle 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/ */
// src/Controller/RssController.php
//...
#[Route('/rss.xml', name: 'app_rss_feed')]
public function index(EasyRss $easyRss): Response
{
return $easyRss->getResponse('Title for RSS feed');
}
//...
// src/any-place-in-your-project
//...
$feed = new \Fabricio872\EasyRssBundle\DTO\Feed();
$feed->setTitle('My first post');
$feed->setDescription('This is my first post.');
//...
// src/any-place-in-your-project
//...
public function someMethodWithDependencyInjection(\Fabricio872\EasyRssBundle\EasyRss $easyRss)
{
$easyRss->setMaxFeeds(); // OPTIONAL this option is override for what you have set in config
$easyRss->add($feed); // this will put your feed to DB and remove old feeds if there are more than MaxFeeds
}
//...
// src/Controller/RssController.php
//...
#[Route('/rss_one.xml', name: 'app_rss_one_feed')]
public function rss_one(EasyRss $easyRss): Response
{
return $easyRss->getResponse('Title for first RSS feed', 'first'); // second parameter is channel identifier
}
#[Route('/rss_two.xml', name: 'app_rss_two_feed')]
public function rss_two(EasyRss $easyRss): Response
{
return $easyRss->getResponse('Title for second RSS feed', 'second'); // second parameter is channel identifier
}
//...
// src/any-place-in-your-project
//...
$feed = new \Fabricio872\EasyRssBundle\DTO\Feed();
$feed->setTitle('My first post');
$feed->setChannel('first'); // name of the channel has to be same as defined in controller
$feed->setDescription('This is my first post.');
//...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.