SitemapGenerator
final class SitemapGenerator (View source)
Normalizes sitemap URLs and serializes them either to a target stream or as lazy XML chunks
Methods
Initializes sitemap generation with provider discovery and URL normalization dependencies
Lazily resolves valid sitemap URLs from registered providers
Lazily yields XML urlset chunks without assembling the full sitemap in memory
Writes a complete XML urlset to the supplied resource stream
Writes the beginning of an XML urlset through the XML writer
Writes the end of an XML urlset through the XML writer
Writes one URL element with all available sitemap attributes
Details
__construct
__construct(SitemapProviderRegistry $registry, BaseUrlResolver $baseUrlResolver, SitemapConfig $config, LoggerInterface|null $logger = null)
Initializes sitemap generation with provider discovery and URL normalization dependencies
urls
iterable
urls()
Lazily resolves valid sitemap URLs from registered providers
urlsetChunks
iterable
urlsetChunks(iterable $urls)
Lazily yields XML urlset chunks without assembling the full sitemap in memory
writeUrlset
array
writeUrlset(resource $stream, iterable $urls)
Writes a complete XML urlset to the supplied resource stream
startUrlset
void
startUrlset(XmlStreamWriter $xml)
Writes the beginning of an XML urlset through the XML writer
endUrlset
void
endUrlset(XmlStreamWriter $xml)
Writes the end of an XML urlset through the XML writer
writeUrlElement
void
writeUrlElement(XmlStreamWriter $xml, SitemapUrl $url)
Writes one URL element with all available sitemap attributes