PHPackages                             symkit/sitemap-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. symkit/sitemap-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

symkit/sitemap-bundle
=====================

A modern, high-performance Symfony bundle for XML sitemap generation

v0.0.3(2mo ago)01411MITPHPPHP &gt;=8.2CI passing

Since Feb 21Pushed 2mo agoCompare

[ Source](https://github.com/SymKit/sitemap-bundle)[ Packagist](https://packagist.org/packages/symkit/sitemap-bundle)[ RSS](/packages/symkit-sitemap-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (22)Versions (4)Used By (1)

SitemapBundle
=============

[](#sitemapbundle)

[![CI](https://github.com/symkit/sitemap-bundle/actions/workflows/ci.yml/badge.svg)](https://github.com/symkit/sitemap-bundle/actions)[![Latest Version](https://camo.githubusercontent.com/cc9b8ae9c67e2632ce83abbbecc96f351d00cc4d55080072e0b6d25fed8573f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73796d6b69742f736974656d61702d62756e646c652e737667)](https://packagist.org/packages/symkit/sitemap-bundle)[![PHPStan Level 9](https://camo.githubusercontent.com/1bc07920f0d36e55c17e1d38b1caa132cc605f51a82b388c962870b9a747b898/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e737667)](https://phpstan.org/)

A modern, high-performance Symfony bundle for XML sitemap generation.

Features
--------

[](#features)

- **Performant**: Uses `iterable` and `yield` to handle millions of URLs with minimal memory footprint.
- **Automatic Chunking**: Splits large sitemaps (default &gt; 25,000 URLs) into paginated files.
- **Pretty URLs**: Clean URL structures like `/sitemap/pages-1.xml`.
- **Image Support**: Built-in support for Google Image Sitemaps.
- **Video Support**: Built-in support for Google Video Sitemaps.
- **News Support**: Built-in support for Google News Sitemaps.
- **Multi-language (hreflang)**: `xhtml:link` alternates for multi-language sites.
- **Gzip Compression**: Optional gzip compression for sitemap responses.
- **Taggable Cache**: Optimized caching with tag-based invalidation.
- **Cache Warmup**: Automatic cache warming via `cache:warmup` or CLI command.
- **Console Commands**: `sitemap:generate` (warmup) and `sitemap:debug` (inspect loaders).
- **Profiler**: Symfony Web Debug Toolbar integration with loader stats and generation timing.
- **Async Generation**: Optional Messenger-based async sitemap regeneration (disabled by default).
- **IndexNow**: Automatic search engine notification on sitemap invalidation.
- **robots.txt**: Customizable `robots.txt` serving and automatic `Sitemap:` directive injection.
- **Logging**: PSR Logger integration on the `sitemap` monolog channel.
- **SOLID Architecture**: Contract-based interfaces, `final readonly` services, event-driven.

Installation
------------

[](#installation)

```
composer require symkit/sitemap-bundle
```

Routing
-------

[](#routing)

Import the bundle routes in your application:

```
# config/routes/symkit_sitemap.yaml
symkit_sitemap:
    resource: '@SymkitSitemapBundle/config/routes.php'
```

This registers three routes:

RoutePathDescription`symkit_sitemap_index``/sitemap.xml`Sitemap index`symkit_sitemap_show``/sitemap/{name}.xml`Single sitemap`symkit_sitemap_show_paginated``/sitemap/{name}-{page}.xml`Paginated sitemapConfiguration
-------------

[](#configuration)

```
# config/packages/symkit_sitemap.yaml
symkit_sitemap:
    items_per_page: 25000
    gzip: false
    robots_txt:
        enabled: false
        content: ~            # Full robots.txt content (serves /robots.txt when set)
        inject_sitemap: true  # Auto-append Sitemap: directive
    cache:
        enabled: false
        pool: 'cache.app.taggable'
        tag: 'sitemap'
        ttl: 3600
    messenger:
        enabled: false
        transport: 'async'
    index_now:
        enabled: false
        api_key: ~ # Your IndexNow API key
        host: ~    # Optional: your site hostname
```

ParameterTypeDefaultDescription`items_per_page``integer``25000`Maximum URLs per sitemap chunk`gzip``boolean``false`Enable gzip compression for sitemap responses`robots_txt.enabled``boolean``false`Enable the robots.txt feature`robots_txt.content``string``null`Full robots.txt content — when set, the bundle serves `/robots.txt` with this content`robots_txt.inject_sitemap``boolean``true`Auto-append `Sitemap:` directive to robots.txt responses`cache.enabled``boolean``false`Enable caching for generated sitemaps`cache.pool``string``cache.app.taggable`Symfony cache pool (must support tagging)`cache.tag``string``sitemap`Cache tag for sitemap entries`cache.ttl``integer``3600`Cache TTL in seconds`messenger.enabled``boolean``false`Enable async sitemap generation via Messenger`messenger.transport``string``async`Messenger transport name`index_now.enabled``boolean``false`Enable IndexNow notifications on invalidation`index_now.api_key``string``null`IndexNow API key`index_now.host``string``null`Site hostname for IndexNowUsage
-----

[](#usage)

### 1. Create a Loader

[](#1-create-a-loader)

Implement `SitemapLoaderInterface`. With autoconfiguration enabled, the bundle detects it automatically:

```
namespace App\Sitemap;

use Symkit\SitemapBundle\Contract\SitemapLoaderInterface;
use Symkit\SitemapBundle\Model\SitemapUrl;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

final readonly class ProductSitemapLoader implements SitemapLoaderInterface
{
    public function __construct(
        private ProductRepository $repository,
        private UrlGeneratorInterface $urlGenerator,
    ) {
    }

    public function count(): int
    {
        return $this->repository->countAllActive();
    }

    public function load(int $limit, int $offset): iterable
    {
        foreach ($this->repository->findBy([], null, $limit, $offset) as $product) {
            yield new SitemapUrl(
                loc: $this->urlGenerator->generate(
                    'app_product_show',
                    ['slug' => $product->getSlug()],
                    UrlGeneratorInterface::ABSOLUTE_URL,
                ),
                lastmod: $product->getUpdatedAt(),
                changefreq: 'daily',
                priority: '0.8',
            );
        }
    }
}
```

### 2. Multi-language (hreflang)

[](#2-multi-language-hreflang)

```
use Symkit\SitemapBundle\Model\SitemapAlternate;
use Symkit\SitemapBundle\Model\SitemapUrl;

yield new SitemapUrl(
    loc: 'https://example.com/en/page',
    alternates: [
        new SitemapAlternate('fr', 'https://example.com/fr/page'),
        new SitemapAlternate('de', 'https://example.com/de/page'),
        new SitemapAlternate('x-default', 'https://example.com/en/page'),
    ],
);
```

### 3. Video Sitemaps

[](#3-video-sitemaps)

```
use Symkit\SitemapBundle\Model\SitemapUrl;
use Symkit\SitemapBundle\Model\SitemapVideo;

yield new SitemapUrl(
    loc: 'https://example.com/videos/my-video',
    videos: [
        new SitemapVideo(
            thumbnailLoc: 'https://example.com/thumbs/my-video.jpg',
            title: 'My Video Title',
            description: 'A description of the video.',
            contentLoc: 'https://example.com/videos/my-video.mp4',
            duration: '600',
        ),
    ],
);
```

### 4. News Sitemaps

[](#4-news-sitemaps)

```
use Symkit\SitemapBundle\Model\SitemapNews;
use Symkit\SitemapBundle\Model\SitemapUrl;

yield new SitemapUrl(
    loc: 'https://example.com/news/breaking-story',
    news: new SitemapNews(
        publicationName: 'Example Times',
        publicationLanguage: 'en',
        title: 'Breaking Story Title',
        publicationDate: new \DateTimeImmutable(),
    ),
);
```

### 5. Cache Invalidation

[](#5-cache-invalidation)

Dispatch `SitemapInvalidateEvent` or call `SitemapCacheManagerInterface::invalidate()`:

```
use Symkit\SitemapBundle\Contract\SitemapCacheManagerInterface;

final readonly class ProductEventSubscriber
{
    public function __construct(
        private SitemapCacheManagerInterface $cacheManager,
    ) {
    }

    public function onProductUpdate(): void
    {
        $this->cacheManager->invalidate();
    }
}
```

### 6. Custom Loader Name

[](#6-custom-loader-name)

By default, the sitemap name is the `snake_case` version of your loader class name. Override it with the tag `index` attribute:

```
services:
    App\Sitemap\ProductSitemapLoader:
        tags:
            - { name: 'symkit_sitemap.loader', index: 'products' }
```

Console Commands
----------------

[](#console-commands)

### `sitemap:generate`

[](#sitemapgenerate)

Generate and warm up all sitemap caches:

```
php bin/console sitemap:generate
php bin/console sitemap:generate --name=products
```

### `sitemap:debug`

[](#sitemapdebug)

Display registered loaders with URL counts and page numbers:

```
php bin/console sitemap:debug
```

Events
------

[](#events)

EventWhen`SitemapPreGenerateEvent`Before sitemap XML generation`SitemapPostGenerateEvent`After sitemap XML generation (contains XML)`SitemapInvalidateEvent`When cache invalidation is triggeredContributing
------------

[](#contributing)

```
# Install dependencies
make install

# Run full quality pipeline
make quality
```

Available targets: `make cs-fix`, `make phpstan`, `make test`, `make deptrac`, `make infection`, `make quality`, `make ci`.

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance83

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

85d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/077eba6702dc23a795ee2262dff92505e3c8ead08f7cb205be80d8aae0a6b8e5?d=identicon)[sdieunidou](/maintainers/sdieunidou)

---

Top Contributors

[![sdieunidou](https://avatars.githubusercontent.com/u/570763?v=4)](https://github.com/sdieunidou "sdieunidou (9 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/symkit-sitemap-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/symkit-sitemap-bundle/health.svg)](https://phpackages.com/packages/symkit-sitemap-bundle)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
