8fold/php-sitemap

用于生成Sitemap(XML)的库

2.0.0 2022-12-13 00:24 UTC

This package is auto-updated.

Last update: 2024-09-13 05:15:34 UTC


README

根据Sitemap协议生成有效的XML文档和sitemap元素。

安装

composer require 8fold/php-sitemap

用法

您已在一个数组中收到所需的元数据;可能是数据库查询的结果。

use Eigthfold\Sitemap\Sitemap;

$sitemap = Sitemap::create('http://yourdomain.com');

$items = // your array of items

foreach ($items as $item) {
  $sitemap = $sitemap->addUrl(
    $item->path
  );
}

(string) $sitemap;

详细信息

设计用于在循环中使用。

其他

{链接或描述或许可证,版本管理和治理}