PHP code example of denismitr / sitemap

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

    

denismitr / sitemap example snippets


$sitemap = new Sitemap('http://moskvado.ru/');
$sitemap
    ->setExcluded(['http://moskvado.ru/dashboard/', 'http://moskvado.ru/register/', 'http://moskvado.ru/login/'])
    ->setLevel(0, 1, 'daily')
    ->setLevel(1, 0.80, 'weekly')
    ->setLevel(2, 0.64, 'weekly')
    ->setLevel(3, 0.64, 'monthly')
    ->setDefaultUpdatePeriod('monthly')
    ->setMinimalProirity(0.5);


    $links = $sitemap->generate();
    $links->toXmlFile('sitemap.xml');