1. Go to this page and download the library: Download jantaodev/sitemap-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/ */
jantaodev / sitemap-bundle example snippets
...
public function registerBundles()
{
$bundles = array(
...
new JantaoDev\SitemapBundle\JantaoDevSitemapBundle(),
...
);
...
namespace AppBundle\EventListener;
use JantaoDev\SitemapBundle\Service\SitemapListenerInterface;
use JantaoDev\SitemapBundle\Event\SitemapGenerateEvent;
use JantaoDev\SitemapBundle\Sitemap\Url;
class SomeListener implements SitemapListenerInterface
{
public function generateSitemap(SitemapGenerateEvent $event)
{
$sitemap = $event->getSitemap();
$url = new Url('/index.php', new \DateTime('now'), 0.8, 'weekly');
$sitemap->add($url);
}
}