定制 euskadi31/sitemap-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

euskadi31/sitemap-php

最新稳定版本:v0.2.0

Composer 安装命令:

composer require euskadi31/sitemap-php

包简介

A PHP 5.3+ framework for sitemap

README 文档

README

Sitemap generator

Example

Sitemap

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

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.

统计信息

  • 总下载量: 219
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-02