PHPackages                             webarchitect609/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. webarchitect609/sitemap

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

webarchitect609/sitemap
=======================

Generate sitemap.xml with respect to robots.txt disallow rules, according specification https://www.sitemaps.org and without dependencies from any framework or cms.

v0.1.1(7y ago)21.2k1MITPHPPHP ^7.0

Since Jul 13Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (7)Used By (0)

Sitemap generation and deploy tool
==================================

[](#sitemap-generation-and-deploy-tool)

**Be careful**: this version can be unstable and all interfaces can be changed in near future.

Features
--------

[](#features)

- Respect of [Sitemaps XML format](https://www.sitemaps.org/protocol.html) and it's limits;
- Sitemapindex is always supported;
- Automatic setup 'lastmod' for sitemap in sitemapindex with the most fresh 'lastmod' from it's urls;
- Automatic adding hostname for urls;
- Respect of [robots.txt](https://developers.google.com/search/reference/robots_txt) `Disallow` rules for '\*' agent to help you avoid undesired urls in your sitemap;
- Write to a temporary folder and deploy to final destination to avoid damaging old copy in a case of troubles;
- No dependencies from any framework;

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

[](#how-to-use)

1 Install via [composer](https://getcomposer.org/)

`composer require webarchitect609/sitemap`

2 Create writer instance

`$sitemapWriter = new \WebArch\Sitemap\SitemapWriter('http://example.org', '/var/www/example.org/htdocs');`

3 For simple usage just start to add urls directly to writer

```
use WebArch\Sitemap\Enum\ChangeFreq;
use WebArch\Sitemap\Model\Url;

$url1 = (new Url('/index.php'))->withChangefreq(ChangeFreq::CHANGE_FREQ_DAILY)
                               ->withPriority(0.9)
                               ->withLastmod(
                                   DateTimeImmutable::createFromFormat(
                                       'Y-m-d H:i:s',
                                       '2018-07-13 10:37:48'
                                   )
                               );

$url2 = (new Url('/news/index.php'))->withChangefreq(ChangeFreq::CHANGE_FREQ_HOURLY);

$sitemapWriter->addUrl($url1)
              ->addUrl($url2);

```

4 For more complicated case you can create as many sitemaps as you need and give them to writer:

```
$newsSitemap = new \WebArch\Sitemap\Model\Sitemap('/sitemap_news.xml');

$newsSitemap->addUrl(
                (new Url('/news/detail/1/'))
            )
            ->addUrl(
                (new Url('/news/detail/2/'))
            )
            ->addUrl(
                (new Url('/news/detail/3/'))
            );

$sitemapWriter->addSitemap($newsSitemap);

```

5 Additional options can be applied to respect sitemap limitations

```
/**
 * Limit maximum urls count. When it's overflowed an `\WebArch\Sitemap\Exception\UrlCountLimitException` would be issued.
 * It's ON by default.
 */
$newsSitemap->getUrlSet()->withMaxUrlCount(50000);

/**
 * Limit maximum file size
 * It's OFF by default.
 * WARNING: it WILL slow down everything: after adding new url estimated size calculations would be executed.
 * (Hope to get rid of this in the future)
 */
$newsSitemap->getUrlSet()->withMaxXmlSizeBytes(10*1024*1024);

```

6 And then just let it work

```
$sitemapWriter->write();

```

After this everything will be written to `sys_get_temp_dir()`. If there were no errors new version of sitemapindex + all sitemaps will be deployed to it's final destination at `$sitemapWriter->getBaseDir()` and file permissions will be changed in a way to let everybody read them.

Running Unit-tests
------------------

[](#running-unit-tests)

`composer test`

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% 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 ~30 days

Recently: every ~37 days

Total

6

Last Release

2716d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f9a6e3ee8c76415a66949c630cd1281bfb6a232a5648b2410574fb6e1e09b65?d=identicon)[webarchitect609](/maintainers/webarchitect609)

---

Top Contributors

[![webarchitect609](https://avatars.githubusercontent.com/u/11293610?v=4)](https://github.com/webarchitect609 "webarchitect609 (5 commits)")[![StepanRodionov](https://avatars.githubusercontent.com/u/19999922?v=4)](https://github.com/StepanRodionov "StepanRodionov (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[wallabag/wallabag

open source self hostable read-it-later web application

12.6k2.2k](/packages/wallabag-wallabag)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sylius/promotion

Flexible promotion management for PHP applications.

28477.8k9](/packages/sylius-promotion)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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