PHP code example of xlient / xml-sitemap

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

    

xlient / xml-sitemap example snippets


$sitemapIterator = new \Xlient\Xml\Sitemap\SitemapIterator();
$sitemapIterator->open(
    __DIR__ . '/sitemap.xml',
    [
        // Skip over urls that have not been modified since this date.
        'modified_date_time' => null, // DateTime|string
        // Skip over urls that have a priority lower than this value.
        'minimum_priority' => null, // float
        // Specify the encoding of the sitemap.
        'encoding' => null, // String
    ]
);

foreach ($sitemapIterator as $url => $data) {
    ...
}

$sitemapIterator->close();