https://github.com/euskadi31/sitemap-php
A PHP 5.3+ framework for sitemap
https://github.com/euskadi31/sitemap-php
Last synced: 3 months ago
JSON representation
A PHP 5.3+ framework for sitemap
- Host: GitHub
- URL: https://github.com/euskadi31/sitemap-php
- Owner: euskadi31
- License: mit
- Created: 2015-04-02T14:10:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-01-29T09:43:06.000Z (over 9 years ago)
- Last Synced: 2025-01-19T18:49:01.789Z (5 months ago)
- Language: PHP
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Sitemap [](http://travis-ci.org/euskadi31/sitemap-php)
=======Sitemap generator
Example
-------Sitemap
~~~php
require 'path/to/vendor/autoload.php';$sitemap = new Euskadi31\Component\Sitemap\Writer\Sitemap();
//$sitemap->setCompression(true);
//$sitemap->setCompressionLevel(9);$sitemap->addUrl('https://www.domain.tld/my/page1.html');
$sitemap->addUrl(
'https://www.domain.tld/my/page2.html',
new DateTime('2015-03-09 18:00:00')
);$sitemap->addUrl(
'https://www.domain.tld/my/page3.html',
new DateTime('2015-03-09 18:01:00'),
Sitemap::CHANGEFREQ_DAILY
);$sitemap->addUrl(
'https://www.domain.tld/my/page4.html',
new DateTime('2015-03-09 18:02:00'),
Sitemap::CHANGEFREQ_HOURLY,
0.8
);//file_put_contents(__DIR__ . '/sitemap.xml.gz', $sitemap->render());
file_put_contents(__DIR__ . '/sitemap.xml', $sitemap->render());
~~~Sitemap index
~~~php
require 'path/to/vendor/autoload.php';$index = new Euskadi31\Component\Sitemap\Writer\SitemapIndex();
//$index->setCompression(true);
//$index->setCompressionLevel(9);$index->addSitemap('https://www.domain.tld/sitemap_product.xml');
$index->addSitemap(
'https://www.domain.tld/sitemap.xml',
new DateTime('2015-03-09 18:00:00')
);//file_put_contents(__DIR__ . '/sitemap_index.xml.gz', $index->render());
file_put_contents(__DIR__ . '/sitemap_index.xml', $index->render());
~~~License
-------sitemap-php is licensed under [the MIT license](LICENSE.md).