What Sitemap by samdark does
Sitemap is a PHP library that writes XML sitemap files and XML sitemap index files. You install it with Composer, create a Sitemap object pointed at an output file path, and add URLs with addItem(), passing an optional last-modified time, change frequency, priority and image URLs. Calling write() produces the file, and getSitemapUrls() returns the public URLs of what was written. The project is BSD-3-Clause licensed and its repository was created in June 2015.
When a URL limit or a file size limit is reached, the library starts a new sitemap file automatically. Index objects let you list the generated sitemap files. It also supports multi-language sitemap files, image sitemap entries and a custom XSL stylesheet set through setStylesheet(). The README describes the library as fast and memory efficient, and the repository ships commands for tests, PHPStan, Rector and PHPBench benchmarks.
Key features
- Regular and gzipped sitemaps
- Creates sitemap files either as plain XML or gzipped.
- Multi-language sitemap files
- Builds multi-language sitemap files; the README shows a separate example using Sitemap and Index.
- Image sitemap entries
- Image URLs are passed as the fifth argument of addItem() and written into the entry.
- Sitemap index files
- The Index class writes an index that points at the individual sitemap files produced.
- Automatic file splitting
- Starts a new sitemap file once the URL limit or the file size limit is reached.
- Custom XSL stylesheet
- setStylesheet() attaches a stylesheet URL so the generated XML renders through your own XSL file.
- Change frequency and priority
- addItem() accepts a last-modified time, frequency constants such as DAILY and WEEKLY, and a priority value.
- Composer installation
- Installed with composer require samdark/sitemap, then autoloaded through vendor/autoload.php.
- Test and static analysis setup
- Repository documents commands for running tests, PHPStan checks, Rector checks and PHPBench benchmarks.
How it works
- Install with composer require samdark/sitemap and include vendor/autoload.php in your application.
- Create a Sitemap object with the path of the XML file you want written.
- Call addItem() for each URL, optionally passing last-modified time, change frequency, priority and image URLs.
- Optionally set a custom XSL stylesheet with setStylesheet() before writing.
- Call write() to produce the file, with new files started when limits are reached.
- Read the public URLs with getSitemapUrls() and list them in an Index object.
Plans and pricing
The library is free open source software under the BSD-3-Clause licence; the material lists no paid plans.
Integrations and platforms
Works with
- Composer
Available as
- Web
Repository facts
- Repositorysamdark/sitemap
- LanguagePHP
- Stars548
- Forks93
- LicenceBSD-3-Clause
- Created2015-06-29
- Last commit2026-07-20
- Open issues0
- hacktoberfest
- php
- sitemap
Services and details
Does SEO work itself
YesFree plan or free tools
Yes
No information yet on keyword research, content optimization, writes content with AI, technical audits, rank tracking, backlinks and link building, local SEO, AI search visibility, free trial, API or MCP server, WordPress plugin, browser extension, built for agencies. The website did not say; check with the vendor.
About the company
- Company samdark
- Type Open source project
- Website: github.com/samdark/sitemap
Listing compiled from public sources and the product's own website. Last updated 2026-11-12. Report a correction or request removal. Back to GitHub repos.