1. Go to this page and download the library: Download kri55h/php-sitemapper 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/ */
kri55h / php-sitemapper example snippets
use Kri55h\SiteMapper;
Kri55h\SiteMapper;
$map = new SiteMapper();
// Add and save entries (pass full URLs)
$map->addUrl('https://example.com/about', 0.8, '2025-08-09', 'daily')->save()
->addUrl('https://example.com/contact', 0.5, '2025-08-09', 'weekly')->save();
// Return XML from a controller or script
header('Content-Type: application/xml; charset=UTF-8');
echo $map->generateXml();
Kri55h\SiteMapper;
$map = new SiteMapper();
// Staged style: call setters, then save()
$map->addUrl('https://example.com/')
->setPriority(1.0)
->setLastModified('2025-08-09')
->setChangeFrequency('daily')
->save();
// Another entry, using positional args
$map->addUrl('https://example.com/about', 0.8, '2025-08-09', 'weekly')->save();
// Save sitemap to disk
$map->saveToFile(__DIR__ . '/public/sitemap.xml');
// Or output directly (sets header + echoes XML)
$map->outputXml();