stopudow / sitemap
This package creates sitemaps for websites in XML, JSON, and CSV formats.
v1.0.1
2025-07-07 00:09 UTC
Requires (Dev)
- phpunit/phpunit: ^12.2
This package is not auto-updated.
Last update: 2025-07-07 06:19:23 UTC
README
Overview
Sitemap is a PHP library that allows you to generate sitemap content in various file formats such as XML, JSON, or CSV. It follows the standard set by www.sitemaps.org.
Installation
You can install Sitemap via Packagist. Simply include the library in your project to get started.
composer require stopudow/sitemap
Usage
Create a new instance of sitemap, pass in the list of pages with parameters, and it will automatically generate the sitemap file in the desired format and save it to the specified directory.
<?php require_once '../vendor/autoload.php'; use Stopudow\Sitemap\Sitemap; $pages = [ [ 'loc' => 'https://example.com/', 'lastmod' => '2020-12-14', 'changefreq' => 'hourly', 'priority' => 1, ], [ 'loc' => 'https://example.com/news', 'lastmod' => '2020-12-10', 'changefreq' => 'daily', 'priority' => 1, ] ]; new Sitemap($pages, 'xml', '../output/sitemap.xml');