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

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

ar2rsoft/sitemap
================

Provides support for site map creation

v2.0.0.0(7y ago)00BSD-3-ClausePHP

Since Dec 26Pushed 6y agoCompare

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

READMEChangelogDependencies (1)Versions (24)Used By (0)

 [ ![](https://avatars2.githubusercontent.com/u/12951949) ](https://github.com/yii2tech)

Site Map Extension for Yii 2
============================

[](#site-map-extension-for-yii-2)

This extension provides support for site map and site map index files generating.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/7b0e18b859a2586e38811904ffd6c94bca3dc25ef66755011850cd9733d8aaa9/68747470733a2f2f706f7365722e707567782e6f72672f79696932746563682f736974656d61702f762f737461626c652e706e67)](https://packagist.org/packages/yii2tech/sitemap)[![Total Downloads](https://camo.githubusercontent.com/bacfdacaf0bb5f3ebad0aad17827b71caa49eb8b171d15eddedc262436384b74/68747470733a2f2f706f7365722e707567782e6f72672f79696932746563682f736974656d61702f646f776e6c6f6164732e706e67)](https://packagist.org/packages/yii2tech/sitemap)[![Build Status](https://camo.githubusercontent.com/8c93a78ea1e4409677c7b741506713e17ecd09146fa3141e18f30c6db40810ef/68747470733a2f2f7472617669732d63692e6f72672f79696932746563682f736974656d61702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yii2tech/sitemap)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist yii2tech/sitemap

```

or add

```
"yii2tech/sitemap": "*"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

This extension provides support for site map and site map index files generation. You can use \[\[\\yii2tech\\sitemap\\File\]\] for site map file composition:

```
use yii2tech\sitemap\File;

$siteMapFile = new File();

$siteMapFile->writeUrl(['site/index'], ['priority' => '0.9']);
$siteMapFile->writeUrl(['site/about'], ['priority' => '0.8', 'changeFrequency' => File::CHECK_FREQUENCY_WEEKLY]);
$siteMapFile->writeUrl(['site/signup'], ['priority' => '0.7', 'lastModified' => '2015-05-07']);
$siteMapFile->writeUrl(['site/contact']);

$siteMapFile->close();
```

In case you put sitemap generation into console command, you will need to manually configure URL manager parameters for it. For example:

```
return [
    'id' => 'my-console-application',
    'components' => [
        'urlManager' => [
            'hostInfo' => 'http://example.com',
            'baseUrl' => '/',
            'scriptUrl' => '/index.php',
        ],
        // ...
    ],
    // ...
];
```

Creating site map index files
------------------------------

[](#creating-site-map-index-files-)

There is a limitation on the site map maximum size. Such file can not contain more then 50000 entries and its actual size can not exceed 10MB. If you web application has more then 50000 pages and you need to generate site map for it, you'll have to split it between several files and then generate a site map index file. It is up to you how you split your URLs between different site map files, however you can use \[\[\\yii2tech\\sitemap\\File::getEntriesCount()\]\] or \[\[\\yii2tech\\sitemap\\File::getIsEntriesLimitReached()\]\] method to check count of already written entries.

For example: assume we have an 'item' table, which holds several millions of records, each of which has a detail view page at web application. In this case generating site map files for such pages may look like following:

```
use yii2tech\sitemap\File;
use app\models\Item;

$query = Item::find()->select(['slug'])->asArray();

$siteMapFileCount = 0;
foreach ($query->each() as $row) {
    if (empty($siteMapFile)) {
        $siteMapFile = new File();
        $siteMapFileCount++;
        $siteMapFile->fileName = 'item_' . $siteMapFileCount . '.xml';
    }

    $siteMapFile->writeUrl(['item/view', 'slug' => $row['slug']]);
    if ($siteMapFile->getIsEntriesLimitReached()) {
        unset($siteMapFile);
    }
}
```

Once all site map files are generated, you can compose index file, using following code:

```
use yii2tech\sitemap\IndexFile;

$siteMapIndexFile = new IndexFile();
$siteMapIndexFile->writeUp();
```

> Note: by default site map files are stored under the path '@app/web/sitemap'. If you need a different file path you should adjust \[\[fileBasePath\]\] field accordingly.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~146 days

Total

21

Last Release

2898d ago

Major Versions

v1.0.7.0 → v2.0.0.02018-06-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0ac9002f1b55c3fe069a7803fa836f50cbbd321e492da66b9a0f553eda544e8?d=identicon)[ar2rsoft](/maintainers/ar2rsoft)

---

Top Contributors

[![klimov-paul](https://avatars.githubusercontent.com/u/1482054?v=4)](https://github.com/klimov-paul "klimov-paul (15 commits)")[![ally-ic](https://avatars.githubusercontent.com/u/39822117?v=4)](https://github.com/ally-ic "ally-ic (12 commits)")[![shyyawn](https://avatars.githubusercontent.com/u/6064438?v=4)](https://github.com/shyyawn "shyyawn (6 commits)")[![xicond](https://avatars.githubusercontent.com/u/2734368?v=4)](https://github.com/xicond "xicond (2 commits)")[![ar2rsoft](https://avatars.githubusercontent.com/u/1770866?v=4)](https://github.com/ar2rsoft "ar2rsoft (1 commits)")

---

Tags

yii2Sitemap

### Embed Badge

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

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

###  Alternatives

[zhelyabuzhsky/yii2-sitemap

A Yii2 tool to generate sitemap.xml.

3439.7k](/packages/zhelyabuzhsky-yii2-sitemap)[mrssoft/yii2-sitemap

Yii2 sitemap extension

1123.9k1](/packages/mrssoft-yii2-sitemap)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)

PHPackages © 2026

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