Skip to content

Simple library to generate sitemap xml files Using PHP and Yii2

License

Notifications You must be signed in to change notification settings

AliObeidat/yii2-sitemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-sitemap

Simple library to generate sitemap xml files Using PHP and Yii2

Installation

The preferred way to install this extension is through composer.

Either run

composer require aliobeidat/yii2-sitemap "*"

or add

"aliobeidat/yii2-sitemap": "*"

to the require section of your composer.json file.

Usage

use aliobeiat/sitemap/SitemapGenerator;

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

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

About

Simple library to generate sitemap xml files Using PHP and Yii2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages