8fold / php-sitemap
A library for generating Sitemaps (XML)
2.0.0
2022-12-13 00:24 UTC
Requires
- php: ^8.1
- 8fold/php-xml-builder: ^2.0
Requires (Dev)
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
README
Generates valid XML document and sitemap elements based on the Sitemap protocol.
Installation
composer require 8fold/php-sitemap
Usage
You have received the required metadata in an array; could be the results of a database query.
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;
Details
Designed to fit within a loop.
Other
{links or descriptions or license, versioning, and governance}