定制 venkatesh-kcet/sitemap 二次开发

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

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

venkatesh-kcet/sitemap

最新稳定版本:v1.0.0

Composer 安装命令:

composer require venkatesh-kcet/sitemap

包简介

Sitemap Generator

README 文档

README

License Version

Description

The Sitemap Generator Library is a student project implemented as a PHP Composer package. It provides a simple and efficient way to generate sitemaps for websites. This library allows you to create XML sitemaps that search engines can use to discover and index the pages on your website.

Features

  • Easy-to-use API for generating sitemaps
  • Support for different types of URLs (e.g., web pages, images, videos, news)
  • Automatic handling of sitemap limits (e.g., maximum URLs per sitemap, sitemap index creation)
  • Customizable options for configuring the sitemap generation process
  • Efficient and scalable for large websites
  • Compatible with popular PHP frameworks and content management systems

Installation

You can install the Sitemap Generator Library using Composer:

composer require venkatesh-kcet/sitemap

Usage

Here is a simple example of how to use the Sitemap Generator Library:

URL Sitemap

<?php
    include "vendor/autoload.php";
    use VenkateshKcet\Sitemap\Sitemap;
    $sitemap = new Sitemap();
    $array = [
        'loc' => "https://pypi.org/search/?q=sitemap",
    ];
    $sitemap->add_url($array);
    $sitemap->write_sitemap(__DIR__, 1000);
    $sitemap->write_sitemapIndex($folderPath = __DIR__, $path = "http://localhost/sitemap/");

Image Sitemap

<?php
    include "vendor/autoload.php";
    use VenkateshKcet\Sitemap\Sitemap;
    $sitemap = new Sitemap();
    $array = [
        'loc' => "https://pypi.org/search/?q=sitemap",
        'images' => ["https://pypi.org/search/1.png", "https://pypi.org/search/2.png"]
    ];
    $sitemap->add_url($array);
    $sitemap->write_sitemap(__DIR__, 1000);
    $sitemap->write_sitemapIndex($folderPath = __DIR__, $path = "http://localhost/sitemap/");

Video Sitemap

<?php
    include "vendor/autoload.php";
    use VenkateshKcet\Sitemap\Sitemap;
    $sitemap = new Sitemap();
    $array = [
        'loc' => "https://pypi.org/search/?q=sitemap",
        'videos' => [
            0 => [
                "thumbnail_loc" => "https://www.example.com/thumbs/123.jpg",
                "title" => "Grilling steaks for summer",
                "description" => "Alkis shows you how to get perfectly done steaks every time",
                "content_loc" => "http://streamserver.example.com/video123.mp4",
                "player_loc" => "https://www.example.com/videoplayer.php?video=123",
                "duration" => 600,
                "expiration_date" => "2021-11-05T19:20:30+08:00",
                "rating" => 4.2,
                "view_count" => 12345,
                "publication_date" => "2007-11-05T19:20:30+08:00",
                "family_friendly" => "yes",
                "restriction" => [
                    "relationship" => "allow",
                    "value" => ["IE", "GB", "US", "CA"]
                ],
                "platform" => [
                    "relationship" => "allow",
                    "value" => ["web", "tv"]
                ],
                "price" => [
                    "currency" => "EUR",
                    "value" => 1.99
                ],
                "requires_subscription" => "yes",
                "uploader" => [
                    "info" => "https://www.example.com/users/grillymcgrillerson",
                    "value" => "GrillyMcGrillerson"
                ],
                "live" => "no",
                "tag" => ["steak", "meat", "summer", "outdoor"]
            ],
            1 => [
                "thumbnail_loc" => "https://www.example.com/thumbs/123.jpg",
                "title" => "Grilling steaks for summer",
                "description" => "Alkis shows you how to get perfectly done steaks every time",
                "content_loc" => "http://streamserver.example.com/video123.mp4",
                "player_loc" => "https://www.example.com/videoplayer.php?video=123"
            ]
        ]
    ];
    $sitemap->add_url($array);
    $sitemap->write_sitemap(__DIR__, 1000);
    $sitemap->write_sitemapIndex($folderPath = __DIR__, $path = "http://localhost/sitemap/");

NEWS Sitemap

<?php
    include "vendor/autoload.php";
    use VenkateshKcet\Sitemap\Sitemap;
    $sitemap = new Sitemap();
    $array = [
        'loc' => "https://pypi.org/search/?q=sitemap",
        'news' => [
            'publication' => [
                'name' => 'The Example Times',
                'language' => 'en'
            ],
            'publication_date' => '2008-12-23',
            'title' => 'Companies A, B in Merger Talks'
        ]
    ];
    $sitemap->add_url($array);
    $sitemap->write_sitemap(__DIR__, 1000);
    $sitemap->write_sitemapIndex($folderPath = __DIR__, $path = "http://localhost/sitemap/");

Combine Sitemap

<?php
    include "vendor/autoload.php";
    use VenkateshKcet\Sitemap\Sitemap;
    $sitemap = new Sitemap();
    $array = [
        'loc' => "https://pypi.org/search/?q=sitemap",
        'images' => ["https://pypi.org/search/1.png", "https://pypi.org/search/2.png"],
        'videos' => [
            0 => [
                "thumbnail_loc" => "https://www.example.com/thumbs/123.jpg",
                "title" => "Grilling steaks for summer",
                "description" => "Alkis shows you how to get perfectly done steaks every time",
                "content_loc" => "http://streamserver.example.com/video123.mp4",
                "player_loc" => "https://www.example.com/videoplayer.php?video=123",
                "duration" => 600,
                "expiration_date" => "2021-11-05T19:20:30+08:00",
                "rating" => 4.2,
                "view_count" => 12345,
                "publication_date" => "2007-11-05T19:20:30+08:00",
                "family_friendly" => "yes",
                "restriction" => [
                    "relationship" => "allow",
                    "value" => ["IE", "GB", "US", "CA"]
                ],
                "platform" => [
                    "relationship" => "allow",
                    "value" => ["web", "tv"]
                ],
                "price" => [
                    "currency" => "EUR",
                    "value" => 1.99
                ],
                "requires_subscription" => "yes",
                "uploader" => [
                    "info" => "https://www.example.com/users/grillymcgrillerson",
                    "value" => "GrillyMcGrillerson"
                ],
                "live" => "no",
                "tag" => ["steak", "meat", "summer", "outdoor"]
            ],
            1 => [
                "thumbnail_loc" => "https://www.example.com/thumbs/123.jpg",
                "title" => "Grilling steaks for summer",
                "description" => "Alkis shows you how to get perfectly done steaks every time",
                "content_loc" => "http://streamserver.example.com/video123.mp4",
                "player_loc" => "https://www.example.com/videoplayer.php?video=123"
            ]
        ],
        'news' => [
            'publication' => [
                'name' => 'The Example Times',
                'language' => 'en'
            ],
            'publication_date' => '2008-12-23',
            'title' => 'Companies A, B in Merger Talks'
        ]
    ];
    $sitemap->add_url($array);
    $sitemap->write_sitemap(__DIR__, 1000);
    $sitemap->write_sitemapIndex($folderPath = __DIR__, $path = "http://localhost/sitemap/");    

For more detailed usage instructions and configuration options, please refer to the documentation.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.

Examples

Here are a few examples of how you can use the Sitemap Generator Library:

  • Generate a sitemap for a simple static website
  • Integrate the sitemap generation into a apy web application

Support

If you need any assistance or have any questions, please open an issue on GitHub.

Feel free to customize the content and structure of the documentation to best fit your library and its features.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固