PHP code example of halimonalexander / sitemap
1. Go to this page and download the library: Download halimonalexander/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/ */
halimonalexander / sitemap example snippets
use \HalimonAlexander\Sitemap;
use \HalimonAlexander\Sitemap\SearchEngines;
$smg = new Sitemap\SitemapGenerator(Sitemap\SitemapGenerator::FORMAT_XML);
$smg->addUrl('http://example.com/');
$smg->addUrl('http://example.com/1&2', date('2019-07-01'));
$sitemaps = $smg->saveSitemap(__DIR__);
$smr = new Sitemap\SitemapRegistrator();
$results = array_merge(
$smr->registrate($sitemaps, new SearchEngines\Bing()),
$smr->registrate($sitemaps, new SearchEngines\Google()),
$smr->registrate($sitemaps, new SearchEngines\Yandex())
);
echo join('<br>', $results);