PHPackages                             ptrufanov1/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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. ptrufanov1/sitemap-generator

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

ptrufanov1/sitemap-generator
============================

Generate sitemap file. File format supports: xml, JSON, csv

v1.0.7(2y ago)014MITPHPPHP ~8.0

Since Nov 17Pushed 2y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (9)Used By (0)

🤖 Sitemap generator
===================

[](#-sitemap-generator)

Generate sitemap file from php. Available formats: xml, json, csv.

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

[](#installation)

Installation via Composer

```
composer require ptrufanov1/sitemap-generator
```

That, make sure your application autoload Composer classes by including vendor/autoload.php.

```
require "vendor/autoload.php";
```

Requirements
------------

[](#requirements)

The minimum requirement by this project template that your Web server supports `PHP 8.0.`

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

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

```
require_once "vendor/autoload.php";

use Ptrufanov1\SitemapGenerator\Sitemap;

$pages = [
	[
		'loc' => 'https://site.ru/',
		'lastmod' => '2022-10-14',
		'priority' => 1,
		'changefreq' => 'hourly',

	],
	[
		'loc' => 'https://site.ru/news',
		'lastmod' => '2022-10-10',
		'priority' => 0.5,
		'changefreq' => 'daily',

	],
	[
		'loc' => 'https://site.ru/about',
		'lastmod' => '2022-10-07',
		'priority' => 0.1,
		'changefreq' => 'weekly',

	],
	[
		'loc' => 'https://site.ru/products',
		'lastmod' => '2022-10-12',
		'priority' => 0.5,
		'changefreq' => 'daily',

	],
	[
		'loc' => 'https://site.ru/products/ps5',
		'lastmod' => '2022-10-11',
		'priority' => 0.1,
		'changefreq' => 'weekly',

	],
	[
		'loc' => 'https://site.ru/products/xbox',
		'lastmod' => '2022-10-12',
		'priority' => 0.1,
		'changefreq' => 'weekly',

	],
	[
		'changefreq' => 'weekly',
		'priority' => 0.3,
		'lastmod' => '2022-10-15',
		'loc' => 'https://site.ru/products/wii',

	]
];

/* Path to save sitemap file */
$path = $_SERVER['DOCUMENT_ROOT']."/sitemap/";

try {
	if (Sitemap::load($pages)->saveXml($path)) {
        echo "Sitemap save successful!";
    }
} catch (Exception $e) {
	echo "Error sitemap generate: ".$e->getMessage();
}
```

Use cases
---------

[](#use-cases)

Generate xml sitemap file

```
Sitemap::load($pages)->saveXml($path)
```

Generate csv sitemap file

```
Sitemap::load($pages)->saveCsv($path)
```

Generate JSON sitemap file

```
Sitemap::load($pages)->saveJson($path)
```

Return `true` if file successful generate. Or throw an exception on error.

[![MIT License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://choosealicense.com/licenses/mit/)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

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 ~64 days

Recently: every ~113 days

Total

8

Last Release

874d ago

PHP version history (2 changes)v1.0.0PHP ^8.0

v1.0.7PHP ~8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9986904?v=4)[Pavel Trufanov](/maintainers/ptrufanov1)[@ptrufanov1](https://github.com/ptrufanov1)

---

Top Contributors

[![ptrufanov1](https://avatars.githubusercontent.com/u/9986904?v=4)](https://github.com/ptrufanov1 "ptrufanov1 (8 commits)")

---

Tags

phpjsonxmlcsvSitemapgenerate

### Embed Badge

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

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

###  Alternatives

[mledoze/countries

List of world countries in JSON, CSV, XML and YAML

6.2k733.8k6](/packages/mledoze-countries)[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

578610.1k1](/packages/faisalman-simple-excel-php)[ee/dataexporter-bundle

Easy export data to CSV, XML, HTML, JSON or XLS

4782.9k](/packages/ee-dataexporter-bundle)[dracoblue/craur

A lossless xml to json and json to xml converter (and csv/xlsx/yaml). Writing PHP Json/Xml/Csv/Yaml/excel Importers made easy

4643.9k3](/packages/dracoblue-craur)

PHPackages © 2026

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