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

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

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

vinex56/sitemap-generator

Composer 安装命令:

composer require vinex56/sitemap-generator

包简介

Library for generating website sitemaps in XML, CSV, and JSON formats.

README 文档

README

Sitemap Generator is a PHP library for generating sitemaps in XML, CSV, and JSON formats. This library allows you to easily create sitemaps for your website and save them in the desired format.

Installation

You can install the library via Composer. Run the following command in your project directory:

composer require vinex56/sitemap-generator:dev-master

Usage

Here is an example of how to use the Sitemap Generator:

require 'vendor/autoload.php';
use Vinex56\SitemapGenerator\SitemapGenerator;
$pages = [
    [
        'loc' => 'https://site.ru/',
        'lastmod' => '2020-12-14',
        'priority' => '1',
        'changefreq' => 'hourly'
    ],
    [
        'loc' => 'https://site.ru/news',
        'lastmod' => '2020-12-10',
        'priority' => '0.5',
        'changefreq' => 'daily'
    ],
    [
        'loc' => 'https://site.ru/about',
        'lastmod' => '2020-12-07',
        'priority' => '0.1',
        'changefreq' => 'weekly'
    ]
];
try {
    $sitemap = new SitemapGenerator($pages, 'json', __DIR__ . '/upload/sitemap.json');
    $sitemap->generate();
    echo "Sitemap generated successfully.\n";
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
}

Features

Supports generating sitemaps in XML, CSV, and JSON formats. Automatically creates the directory for the sitemap file if it doesn't exist. Validates input data to ensure proper sitemap generation. Throws custom exceptions for various errors (e.g., invalid data, file write errors).

Requirements

  • PHP 7.4 or higher
  • Composer

License

This library is licensed under the MIT License. See the LICENSE file for more details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固