1. Go to this page and download the library: Download ichinya/sitemap-generator 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/ */
ichinya / sitemap-generator example snippets
// Создаём объект, по умолчанию будет выбрано weekly, 0.5
$s = new \Ichinya\SitemapGenerator\Sitemap();
// можно поменять при создании
$s = new \Ichinya\SitemapGenerator\Sitemap('daily', 0.3);
// добавляем нужные ссылки
// 4 параметра:
// ссылка на страницу,
// время в timestamp,
// период обновления (always, hourly, daily, weekly, monthly, yearly, never)
// приоритет от 0.0 до 1.0, по умолчанию 0.5
$s->addUrl('https://site.ru/', time());
$s->addUrl('https://site.ru/about', strtotime('2021-09-30'), 'monthly', 0.3);
// Вывод с генерацией формата xml
$s->render(true);
// OR получаем ленту и сами выводим
header('Content-Type: application/xml; charset=utf-8');
echo $s->render();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.