PHP code example of webit / sitemap-bundle

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

    

webit / sitemap-bundle example snippets


namespace MyProject;

use Webit\Sitemap\Exposer\UrlExposerInterface;
use Webit\Sitemap\Model\UrlSet;
class MyExposer implements UrlExposerInterface
{
    /**
     * @return UrlSet
     */
    public function getUrlSet()
    {
        $urlSet = new UrlSet();
        
        $url = new Url();
        $url->setLocation('http://page.url/my-site');
        $urlSet->addUrl(new Url());
        
        // add to $urlSet all urls you need 
        
        return $urlSet;
    }
}

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Webit\Bundle\SitemapBundle\WebitSitemapBundle(),
    // ...
);