PHP code example of vedebel / sitemap

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

    

vedebel / sitemap example snippets


$client = new GuzzleHttp\Client();
$parser = new Symfony\Component\DomCrawler\Crawler();
$storage = new vedebel\sitemap\BasicLinksStorage();

$generator = new vedebel\sitemap\Sitemap($parser, $storage, $url, ['limit' => 200, 'debug' => 1]);
$generator->setLoader($client);
$generator->crawl();
$generator->saveXml('sitemap.xml');

$generator->setCallback(function(array $scanned, array $added, array $queue) {
    echo "This is message form callback.\nScanned: "
        . count($scanned) . "\nAdded: " . count($added) . "\nQueue: " . count($queue) . "\n";
}, 10);