svc/sitemap-bundle

Bundle to create easy XML sitemaps and robots.txt files

Installs: 146

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

pkg:composer/svc/sitemap-bundle

1.2.0 2025-10-13 08:40 UTC

This package is auto-updated.

Last update: 2025-10-13 08:40:26 UTC


README

CI Latest Stable Version License Total Downloads PHP Version Require

This bundle creates easy XML sitemaps and robots.txt files in a Symfony application

Features

  • XML Sitemap Generation with full support for lastmod, changefreq, and priority
  • PHP Attributes Support - Modern #[Sitemap] and #[Robots] attributes for type-safe configuration (PHP 8+)
  • Multi-language Support with hreflang alternate URLs
  • robots.txt Generation with optional sitemap reference
  • Static & Dynamic Routes via event system
  • Security Validation - Prevents XSS (javascript:, data: schemes blocked)
  • UTF-8 Validation - Ensures all content is valid UTF-8
  • Size Limits - Automatic validation (50,000 URLs / 50MB per sitemap)
  • Console Commands for easy generation
  • GZIP Support for compressed sitemaps

Short examples

sitemap.xml

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://shorter.li/svc-contactform/de/contact/</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.2</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/svc-contactform/de/contact/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/svc-contactform/en/contact/"/>
  </url>
  <url>
    <loc>https://shorter.li/de/</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/de/"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/en/"/>
  </url>
  <url>
    <loc>https://shorter.li/login/de</loc>
    <lastmod>2024-12-09T15:07:58+01:00</lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.1</priority>
    <xhtml:link rel="alternate" hreflang="de" href="https://shorter.li/login/de"/>
    <xhtml:link rel="alternate" hreflang="en" href="https://shorter.li/login/en"/>
  </url>
</urlset>

robots.txt

User-agent: google
Allow: /
Allow: /de/
Allow: /en/
Allow: /public
Disallow: /admin

User-agent: bing
Allow: /
Disallow: /de/
Disallow: /en/
Disallow: /admin

User-agent: *
Disallow: /

Sitemap: https://example.com/sitemap.xml

Documentation

Sitemap

Robots.txt

Note

Many thanks to the creators of the PrestaSitemapBundle. From there I got many ideas and sometimes also some code...