PHP code example of darvinstudio / darvin-sitemap-bundle

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

    

darvinstudio / darvin-sitemap-bundle example snippets


// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Darvin\SitemapBundle\DarvinSitemapBundle(),
        // ...
    );
}

// src/AppBundle/Sitemap/TestSitemapUrlProvider.php


namespace AppBundle\Sitemap;

use Darvin\SitemapBundle\Url\SitemapUrl;
use Darvin\SitemapBundle\Url\SitemapUrlProviderInterface;

class TestSitemapUrlProvider implements SitemapUrlProviderInterface
{
    public function getSitemapUrls()
    {
        $urls = array();
        
        $urls[] = new SitemapUrl('http://example.com', new \DateTime('2016-01-01'), 'always', 0.5);

        return $urls;
    }
}