pendalf89/yii2-sitemap-generator

Yii2 sitemap generator component

dev-master 2016-08-02 07:23 UTC

This package is auto-updated.

Last update: 2024-10-28 08:23:26 UTC


README

Yii2 Sitemap Generator component

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist pendalf89/yii2-sitemap-generator "*"

or add

"pendalf89/yii2-sitemap-generator": "*"

to the require section of your composer.json file.

Usage

use pendalf89/sitemap/SitemapGenerator;

Yii::$app->urlManager->baseUrl = 'http://site.com'; // base url use in sitemap urls creation

$sitemap = new ArticlesSitemap(); // must implement a SitemapInterface
$sitemapGenerator = new SitemapGenerator([
  'sitemaps' => [$sitemap],
  'dir' => '@webRoot',
]);
$sitemapGenerator->generate();