singularity / yii2-sitemapgenerator
Sitemap Generator for Yii2 framework
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- icamys/php-sitemap-generator: dev-master
- yiisoft/yii2: ~2.0.13
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is auto-updated.
Last update: 2024-12-27 00:53:09 UTC
README
Installation
The preferred way to install this extension is through composer.
Either run
composer require singularity/yii2-sitemapgenerator
or add
"singularity/yii2-sitemapgenerator": "~1.0"
to the require
section of your composer.json
file.
Usage
Quick example:
$generator = new SitemapGenerator([ 'maxURLsPerSitemap' => 20000, 'basePath' => 'frontend/web', 'items' => [ 'https://mysite.com', // url as string ['class' => User::class], // array with ['class'] that have getPublicUrl() method [ 'class' => Post::class, // if ['class'] does not have getPublicUrl() method, 'url' => function (Post $model) { // then ['url'] must be set return ["/post/view/$model->id"]; // ['url'] can be value or callback } ] ] ]); $count = $generator->generate();
Properties
- baseUrl
- basePath
- items
- sitemapFilename
- sitemapIndexFilename
- robotsFilename
- maxURLsPerSitemap
- fs
- runtime
Contributing
Please see CONTRIBUTING for details.
Credits
License
The BSD License (BSD). Please see License File for more information.
#InventTomorrow
www.singularity.is