Skip to content
Simple PHP sitemap generator
Branch: master
Clone or download
icamys Merge pull request #2 from gadelkareem/patch-1
Simplify gzip switch and remove comments
Latest commit b40b2ad Mar 22, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Simplify gzip switch Mar 22, 2018
.gitignore Initial commit Jun 2, 2016 Added usage examples and added docblocks Jun 8, 2016
composer.json Added convertion of internally keeped SplFixedArray to array in getUr… Jun 23, 2016

PHP Sitemap Generator

This class can be used to generate sitemaps.

Internally uses SplFixedArrays, thus is faster and uses less memory.

Usage example:

include "src/SitemapGenerator.php";

$generator = new \Icamys\SitemapGenerator\SitemapGenerator('');

// will create also compressed (gzipped) sitemap
$generator->createGZipFile = true;

// determine how many urls should be put into one file
// according to standard protocol 50000 is maximum value (see
$generator->maxURLsPerSitemap = 50000;

// sitemap file name
$generator->sitemapFileName = "sitemap.xml";

// sitemap index file name
$generator->sitemapIndexFileName = "sitemap-index.xml";

// adding url `loc`, `lastmodified`, `changefreq`, `priority`
$generator->addUrl('', date('c'), 'always', '0.5');

// generating internally a sitemap

// writing early generated sitemap to file

Inspired by @pawelantczak.

You can’t perform that action at this time.