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

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

janci/sitemap-generator
=======================

Sitemap Generator is PHP library to create sitemap.xml file on base html elements a-href in website.

v0.4(12y ago)58493[1 issues](https://github.com/janci/sitemap-generator/issues)GPL-3.0+PHP

Since Jan 1Pushed 12y ago1 watchersCompare

[ Source](https://github.com/janci/sitemap-generator)[ Packagist](https://packagist.org/packages/janci/sitemap-generator)[ RSS](/packages/janci-sitemap-generator/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Sitemap Generator
=================

[](#sitemap-generator)

Sitemap Generator is PHP library to generate sitemap.xml from page link. Scan process searches a-href elements on the page and creates map with links (without links to external pages). Scanning can be used only for one page, when will gets links from the input link. Second option is using scanner to scan recursively. For this option scanner will scan all found links on website. Scanner accepts links starting with "/" or with domain name (website URL).

Scanning process takes several minutes to build sitemap for bigger pages or with slower internet connection. The best practise is to run script from command line (CLI), not from website using web server.

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

[](#installation)

The best way how to install Sitemap Generator is using Composer:

```
php composer.phar require janci/sitemap-generator

```

Sitemap Generator requires PHP 5.3.0 or later.

Usage examples
--------------

[](#usage-examples)

To find all links on the website, use:

```
    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    $urls = $siteMap->getFoundUrls();
```

To get result as sitemap.xml, use:

```
    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    $sitemapXML = $siteMap->getSitemapContent();

    file_put_contents('sitemap.xml', $sitemapXML);
```

Previous two examples use recursive scanning (default). For single page scan is required to set "false" as second parameter of method SitemapGenerator::scanSite:

```
    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"), false);
    ...
```

To show progress information can be used handler function. Handler must be registered before calling scanSite method.

```
    $siteMap = new SitemapGenerator();
    $siteMap->onScanSite[] = function($siteMapGenerator, $scanDriver) {
        echo "{$siteMapGenerator->getProgressStatus()}%\n";
    };
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    ...
```

Thats' all!

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

4561d ago

Major Versions

v0.4 → v1.0-rc12014-01-02

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/322728?v=4)[janci](/maintainers/janci)[@janci](https://github.com/janci)

---

Top Contributors

[![janci](https://avatars.githubusercontent.com/u/322728?v=4)](https://github.com/janci "janci (19 commits)")

### Embed Badge

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

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

PHPackages © 2026

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