承接 miraclebg/php-sitemap-generator 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

miraclebg/php-sitemap-generator

最新稳定版本:2.0.0

Composer 安装命令:

composer require miraclebg/php-sitemap-generator

包简介

Simple PHP sitemap generator.

README 文档

README

Build Status codecov.io Minimum PHP Version Latest Stable Version Total Downloads

Library for sitemap generation and submission.

Internally uses SplFixedArrays, thus is faster and uses less memory then alternatives.

Features:

Usage example:

<?php

include "src/SitemapGenerator.php";

// Setting the current working directory to be output directory
// for generated sitemaps (and, if needed, robots.txt)
// The output directory setting is optional and provided for demonstration purpose.
// By default output is written to current directory. 
$outputDir = getcwd();

$generator = new \Icamys\SitemapGenerator\SitemapGenerator('example.com', $outputDir);

// will create also compressed (gzipped) sitemap
$generator->toggleGZipFileCreation();

// determine how many urls should be put into one file;
// this feature is useful in case if you have too large urls
// and your sitemap is out of allowed size (50Mb)
// according to the standard protocol 50000 is maximum value (see http://www.sitemaps.org/protocol.html)
$generator->setMaxURLsPerSitemap(50000);

// sitemap file name
$generator->setSitemapFileName("sitemap.xml");

// sitemap index file name
$generator->setSitemapIndexFileName("sitemap-index.xml");

// alternate languages
$alternates = [
    ['hreflang' => 'de', 'href' => "http://www.example.com/de"],
    ['hreflang' => 'fr', 'href' => "http://www.example.com/fr"],
];

// adding url `loc`, `lastmodified`, `changefreq`, `priority`, `alternates`
$generator->addURL('http://example.com/url/path/', new DateTime(), 'always', 0.5, $alternates);

// generate internally a sitemap
$generator->createSitemap();

// write early generated sitemap to file(s)
$generator->writeSitemap();

// update robots.txt file in output directory or create a new one
$generator->updateRobots();

// submit your sitemaps to Google, Yahoo, Bing and Ask.com
$generator->submitSitemap();

Testing

Run tests with command:

$ ./vendor/bin/phpunit

Run code coverage:

$ ./vendor/bin/phpunit --coverage-html ./coverage

Changelog

New in 2.0.0:

  • Major code rework
  • No more public properties in generator, using only methods
  • Removed addUrls method in favor of addUrl
  • Fixed bug with robots.txt update
  • Fixed bug in addURL method (empty loc)
  • Unit tests added for quality assurance
  • Updated limits according to sitemaps spec
  • Updated search engines urls
  • Added change frequency validation

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固