PHPackages                             fr05t1k/sitemap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fr05t1k/sitemap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fr05t1k/sitemap
===============

Sitemap and sitemap index builder

2.0.3(10y ago)039BSD-3-ClausePHPPHP &gt;=5.4.0

Since Jun 29Pushed 9y ago1 watchersCompare

[ Source](https://github.com/fr05t1k/sitemap)[ Packagist](https://packagist.org/packages/fr05t1k/sitemap)[ Docs](https://github.com/samdark/sitemap)[ RSS](/packages/fr05t1k-sitemap/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (8)Used By (0)

Sitemap
=======

[](#sitemap)

Sitemap and sitemap index builder.

[![](https://camo.githubusercontent.com/d34b2f09bcd615ca3d858f9562cffa213f1496eb1eb809a038932f76eed78556/68747470733a2f2f7472617669732d63692e6f72672f73616d6461726b2f736974656d61702e737667)](https://camo.githubusercontent.com/d34b2f09bcd615ca3d858f9562cffa213f1496eb1eb809a038932f76eed78556/68747470733a2f2f7472617669732d63692e6f72672f73616d6461726b2f736974656d61702e737667)

Features
--------

[](#features)

- Create sitemap files.
- Create sitemap index files.
- Automatically creates new file if 50000 URLs limit is reached.
- Memory efficient buffer of configurable size.

Installation
------------

[](#installation)

Installation via Composer is very simple:

```
composer require samdark/sitemap

```

After that, make sure your application autoloads Composer classes by including `vendor/autoload.php`.

How to use it
-------------

[](#how-to-use-it)

```
use samdark\sitemap\Sitemap;
use samdark\sitemap\Index;

// create sitemap
$sitemap = new Sitemap(__DIR__ . '/sitemap.xml');

// add some URLs
$sitemap->addItem('http://example.com/mylink1');
$sitemap->addItem('http://example.com/mylink2', time());
$sitemap->addItem('http://example.com/mylink3', time(), Sitemap::HOURLY);
$sitemap->addItem('http://example.com/mylink4', time(), Sitemap::DAILY, 0.3);

// write it
$sitemap->write();

// get URLs of sitemaps written
$sitemapFileUrls = $sitemap->getSitemapUrls('http://example.com/');

// create sitemap for static files
$staticSitemap = new Sitemap(__DIR__ . '/sitemap_static.xml');

// add some URLs
$staticSitemap->addItem('http://example.com/about');
$staticSitemap->addItem('http://example.com/tos');
$staticSitemap->addItem('http://example.com/jobs');

// write it
$staticSitemap->write();

// get URLs of sitemaps written
$staticSitemapUrls = $staticSitemap->getSitemapUrls('http://example.com/');

// create sitemap index file
$index = new Index(__DIR__ . '/sitemap_index.xml');

// add URLs
foreach ($sitemapFileUrls as $sitemapUrl) {
    $index->addSitemap($sitemapUrl);
}

// add more URLs
foreach ($staticSitemapUrls as $sitemapUrl) {
    $index->addSitemap($sitemapUrl);
}

// write it
$index->write();
```

Options
-------

[](#options)

There are two methods to configre `Sitemap` instance:

- `setMaxUrls($number)`. Sets maximum number of URLs to write in a single file. Default is 50000 which is the limit according to specification and most of existing implementations.
- `setBufferSize($number)`. Sets number of URLs to be kept in memory before writing it to file. Default is 1000. If you have more memory consider increasing it. If 1000 URLs doesn't fit, decrease it.
- `setUseIndent($bool)`. Sets if XML should be indented. Default is true.

Running tests
-------------

[](#running-tests)

In order to run tests perform the following commands:

```
composer install
phpunit

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 73.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Total

5

Last Release

3714d ago

Major Versions

1.0.0 → 2.0.02015-07-03

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f83e9e6dfa100118a2b71023e4219eb312e04527d6e5b593fae94af26f0b3c8?d=identicon)[Fr05t1k](/maintainers/Fr05t1k)

---

Top Contributors

[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (22 commits)")[![fr05t1k](https://avatars.githubusercontent.com/u/2131624?v=4)](https://github.com/fr05t1k "fr05t1k (3 commits)")[![WinterSilence](https://avatars.githubusercontent.com/u/3521094?v=4)](https://github.com/WinterSilence "WinterSilence (3 commits)")[![atailouloute](https://avatars.githubusercontent.com/u/11352491?v=4)](https://github.com/atailouloute "atailouloute (2 commits)")

---

Tags

Sitemap

### Embed Badge

![Health badge](/badges/fr05t1k-sitemap/health.svg)

```
[![Health](https://phpackages.com/badges/fr05t1k-sitemap/health.svg)](https://phpackages.com/packages/fr05t1k-sitemap)
```

###  Alternatives

[samdark/sitemap

Sitemap and sitemap index builder

5401.4M43](/packages/samdark-sitemap)[tackk/cartographer

A PHP sitemap generation tool.

325492.4k3](/packages/tackk-cartographer)[nystudio107/craft-seomatic

SEOmatic facilitates modern SEO best practices &amp; implementation for Craft CMS 5. It is a turnkey SEO system that is comprehensive, powerful, and flexible.

1741.5M52](/packages/nystudio107-craft-seomatic)[novactive/ezseobundle

Novactive eZ SEO Bundle is an Ibexa Platform bundle for SEO simplications. metas, sitemaps, robots.txt, etc.

26256.6k3](/packages/novactive-ezseobundle)[rainlab/sitemap-plugin

Sitemap plugin for October CMS

2280.9k1](/packages/rainlab-sitemap-plugin)[fof/sitemap

Generate a sitemap

1796.4k2](/packages/fof-sitemap)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
