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

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

yii2tech/sitemap
================

Provides support for site map creation

1.1.1(6y ago)58106.5k—0.8%184BSD-3-ClausePHPPHP &gt;=5.6.0

Since Dec 26Pushed 6y ago6 watchersCompare

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

READMEChangelogDependencies (2)Versions (7)Used By (4)

 [ ![](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/61aeda3a50d10c2d7e5f994ffa4da4ab43b94962e185b4a7007be00142d037fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79696932746563682f736974656d61702e737667)](https://packagist.org/packages/yii2tech/sitemap)[![Total Downloads](https://camo.githubusercontent.com/67dd3f119f4e559b46881e9d6a4a5b37f0efd9eaf0b25b80300b33ab171db957/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79696932746563682f736974656d61702e737667)](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:

```
',
    'rootTag' => [
        'tag' => 'urlset',
        'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9',
        'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
        'xmlns:image' => 'http://www.google.com/schemas/sitemap-image/1.1',
        'xsi:schemaLocation' => 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd http://www.google.com/schemas/sitemap-image/1.1 http://www.google.com/schemas/sitemap-image/1.1/sitemap-image.xsd',
    ],
]);

$siteMapFile->writeUrl(['site/index'], ['priority' => '0.9']);
// ...

$siteMapFile->close();
```

Rendering non-standard tags
----------------------------

[](#rendering-non-standard-tags-)

While there is a [standard](http://www.sitemaps.org/), which defines sitemap content, particular search engines may accept extra tags and options. The most widely used are image and video descriptions. Method `\yii2tech\sitemap\File::writeUrl()` supports rendering image and video information.

For adding images to the sitemap entry use 'images' option. For example:

```
