1. Go to this page and download the library: Download thepixeldeveloper/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/ */
thepixeldeveloper / sitemap example snippets
declare(strict_types=1);
use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;
$driver = new XmlWriterDriver();
$driver->addProcessingInstructions('xml-stylesheet', 'type="text/xsl" href="/path/to/xslt/main-sitemap.xsl"');
declare(strict_types=1);
use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;
$date = date('Y-m-d H:i:s');
$driver = new XmlWriterDriver();
$driver->addComment('This XML file was written on ' . $date . '. Bye!');
php
declare(strict_types=1);
use Thepixeldeveloper\Sitemap\Urlset;
use Thepixeldeveloper\Sitemap\Url;
use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;
$url = new Url($loc);
$url->setLastMod($lastMod);
$url->setChangeFreq($changeFreq);
$url->setPriority($priority);
$urlset = new Urlset();
$urlset->add($url);
$driver = new XmlWriterDriver();
$urlset->accept($driver);
echo $driver->output();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.