PHPackages                             voskobovich/yii2-sitemap-module - 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. voskobovich/yii2-sitemap-module

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

voskobovich/yii2-sitemap-module
===============================

Yii2 module for automatically generation XML Sitemap

232PHP

Since Mar 24Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)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 "voskobovich/yii2-sitemap-module" "*"

```

or add

```
"voskobovich/yii2-sitemap-module" : "*"
```

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' => 'voskobovich\sitemap\Module',
        'models' => [
            // your models
            'app\modules\news\models\News',
            // or configuration for creating a behavior
            [
                'class' => 'app\modules\news\models\News',
                'config' => [
                    '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' => \voskobovich\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 voskobovich\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

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4267178fdbc890dad02ce0e600f7f5b9bbb54f5824b90feb76724af8cebb710f?d=identicon)[voskobovich](/maintainers/voskobovich)

---

Top Contributors

[![voskobovich](https://avatars.githubusercontent.com/u/4508703?v=4)](https://github.com/voskobovich "voskobovich (16 commits)")

### Embed Badge

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

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

###  Alternatives

[cubeta/cubeta-starter

Cubeta-Starter: A developer's Swiss army knife for seamless CRUD operations. Choose between core integration or dev dependency. Enjoy a user-friendly GUI for code generation, enhancing your development workflow. Say goodbye to repetition, embrace productivity with Cubeta-Starter!

122.2k](/packages/cubeta-cubeta-starter)

PHPackages © 2026

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