PHP code example of webchemistry / sitemap

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

    

webchemistry / sitemap example snippets


$sitemap = new Sitemap();

$sitemap->add(
	new SitemapItem('http://example.com', new DateTime(), ChangeFrequency::ALWAYS(), 90)
);

echo $sitemap->toString()

$sitemap = new Sitemap();

$sitemap->add(new GoogleNewsItem(
	new SitemapItem('http://example.com'),
	'Example', 'en', 'Subject', new DateTime()
));

echo $sitemap->toString();