PHPackages                             malankateam/yii2-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. malankateam/yii2-sitemap

ActiveYii2-extension[Parsing &amp; Serialization](/categories/parsing)

malankateam/yii2-sitemap
========================

Yii2 module for automatically generation XML Sitemap

1.1.2(10y ago)015MITPHP

Since Sep 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/MalankaTeam/yii2-sitemap)[ Packagist](https://packagist.org/packages/malankateam/yii2-sitemap)[ RSS](/packages/malankateam-yii2-sitemap/feed)WikiDiscussions master Synced yesterday

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

XML Sitemap Module for Yii2
===========================

[](#xml-sitemap-module-for-yii2)

Yii2 module for automatically generating [XML Sitemap](http://www.sitemaps.org/protocol.html).

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

[](#installation)

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

- Either run

```
php composer.phar require --prefer-dist "robot72/yii2-sitemap-module" "*"

```

or add

```
"robot72/yii2-sitemap" : "*"
```

to the `require` section of your application's `composer.json` file.

- Configure the `cache` component of your application's configuration file, for example:

```
'components' => [
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
]
```

- Add a new module in `modules` section of your application's configuration file, for example:

```
'modules' => [
    'sitemap' => [
        'class' => 'robot72\modules\sitemap\Sitemap',
        'models' => [
            // your models
            'app\modules\news\models\News',
            // or configuration for creating a behavior
            [
                'class' => 'app\modules\news\models\News',
                'behaviors' => [
					'sitemap' => [
						'class' => SitemapBehavior::className(),
						'scope' => function ($model) {
						    /** @var \yii\db\ActiveQuery $model */
						    $model->select(['url', 'lastmod']);
						    $model->andWhere(['is_deleted' => 0]);
						},
						'dataClosure' => function ($model) {
						    /** @var self $model */
						    return [
						        'loc' => Url::to($model->url, true),
						        'lastmod' => strtotime($model->lastmod),
						        'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
						        'priority' => 0.8
						    ];
						}
					],
                ],
            ],
        ],
        'urls'=> [
            // your additional urls
            [
                'loc' => '/news/index',
                'changefreq' => \robot72\modules\sitemap\behaviors\SitemapBehavior::CHANGEFREQ_DAILY,
                'priority' => 0.8,
                'news' => [
                    'publication'   => [
                        'name'          => 'Example Blog',
                        'language'      => 'en',
                    ],
                    'access'            => 'Subscription',
                    'genres'            => 'Blog, UserGenerated',
                    'publication_date'  => 'YYYY-MM-DDThh:mm:ssTZD',
                    'title'             => 'Example Title',
                    'keywords'          => 'example, keywords, comma-separated',
                    'stock_tickers'     => 'NASDAQ:A, NASDAQ:B',
                ],
                'images' => [
                    [
                        'loc'           => 'http://example.com/image.jpg',
                        'caption'       => 'This is an example of a caption of an image',
                        'geo_location'  => 'City, State',
                        'title'         => 'Example image',
                        'license'       => 'http://example.com/license',
                    ],
                ],
            ],
        ],
        'enableGzip' => true, // default is false
        'cacheExpire' => 1, // 1 second. Default is 24 hours
    ],
],
```

- Add behavior in the AR models, for example:

```
use robot72\modules\sitemap\behaviors\SitemapBehavior;

public function behaviors()
{
    return [
        'sitemap' => [
            'class' => SitemapBehavior::className(),
            'scope' => function ($model) {
                /** @var \yii\db\ActiveQuery $model */
                $model->select(['url', 'lastmod']);
                $model->andWhere(['is_deleted' => 0]);
            },
            'dataClosure' => function ($model) {
                /** @var self $model */
                return [
                    'loc' => Url::to($model->url, true),
                    'lastmod' => strtotime($model->lastmod),
                    'changefreq' => SitemapBehavior::CHANGEFREQ_DAILY,
                    'priority' => 0.8
                ];
            }
        ],
    ];
}
```

- Add a new rule for `urlManager` of your application's configuration file, for example:

```
'urlManager' => [
    'rules' => [
        ['pattern' => 'sitemap', 'route' => 'sitemap/default/index', 'suffix' => '.xml'],
    ],
],
```

Resources
---------

[](#resources)

- [XML Sitemap](http://www.sitemaps.org/protocol.html)
- [News Sitemap](https://support.google.com/news/publisher/answer/74288?hl=en)
- [Image sitemaps](https://support.google.com/webmasters/answer/178636?hl=en)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.1% 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 ~152 days

Total

3

Last Release

3938d ago

### Community

Maintainers

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

---

Top Contributors

[![himiklab](https://avatars.githubusercontent.com/u/6266409?v=4)](https://github.com/himiklab "himiklab (19 commits)")[![Robot72](https://avatars.githubusercontent.com/u/5987937?v=4)](https://github.com/Robot72 "Robot72 (4 commits)")[![ladamalina](https://avatars.githubusercontent.com/u/2093425?v=4)](https://github.com/ladamalina "ladamalina (2 commits)")[![chuprik](https://avatars.githubusercontent.com/u/802946?v=4)](https://github.com/chuprik "chuprik (1 commits)")

---

Tags

xmlyii2moduleSitemap

### Embed Badge

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

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

###  Alternatives

[presta/sitemap-bundle

A Symfony bundle that provides tools to build your application sitemap.

3929.4M28](/packages/presta-sitemap-bundle)[demi/sitemap-generator

Yii2 component for generate sitemap.xml files.

1427.0k](/packages/demi-sitemap-generator)[light/yii2-xmlparser

yii2 xml request parser

1974.7k](/packages/light-yii2-xmlparser)

PHPackages © 2026

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