PHPackages                             dpn/xml-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. [API Development](/categories/api)
4. /
5. dpn/xml-sitemap-bundle

ActiveSymfony-bundle[API Development](/categories/api)

dpn/xml-sitemap-bundle
======================

Generates XML sitemaps for your favourite search engine by extracting sitemap information out of the site's routes.

v2.1.0(9y ago)2634.2k↓69.5%81MITPHP

Since Jan 28Pushed 4y ago2 watchersCompare

[ Source](https://github.com/bjo3rnf/DpnXmlSitemapBundle)[ Packagist](https://packagist.org/packages/dpn/xml-sitemap-bundle)[ RSS](/packages/dpn-xml-sitemap-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (11)Versions (12)Used By (1)

DpnXmlSitemapBundle
===================

[](#dpnxmlsitemapbundle)

[![Build Status](https://camo.githubusercontent.com/750abef8b7cd00179bae02e74df761aa1c841101ff8bc0b01207c24aac933756/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f626a6f33726e662f44706e586d6c536974656d617042756e646c652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/bjo3rnf/DpnXmlSitemapBundle)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4679b6129f8b071a09b021ca0ff338f7d4a4a5a233360f469faf1a6c20daa59f/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f626a6f33726e662f44706e586d6c536974656d617042756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bjo3rnf/DpnXmlSitemapBundle/)[![Code Coverage](https://camo.githubusercontent.com/680ed7d278bfb01a3a347f9203e02c94eacff26bcd147437d8af29ed332e47d4/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f626a6f33726e662f44706e586d6c536974656d617042756e646c652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/bjo3rnf/DpnXmlSitemapBundle/)[![Latest Stable Version](https://camo.githubusercontent.com/6cc38da9b6aca243e1f1f402c3ea8b19e56180909a58ce97aaec526b22a31877/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64706e2f786d6c2d736974656d61702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dpn/xml-sitemap-bundle)[![License](https://camo.githubusercontent.com/f91de438bc7b46311af2d90de60c6e6de0a65da0113d174ef8b18699f1516081/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64706e2f786d6c2d736974656d61702d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dpn/xml-sitemap-bundle)

This bundle generates XML sitemaps for your favourite search engine by extracting sitemap information out of your application's routes. Additionally, you can create your own generators to provide URLs. The sitemap(s) generated follow the [sitemap protocol](http://www.sitemaps.org/protocol.html).

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

[](#installation)

1. Install with composer:

    ```
     composer require dpn/xml-sitemap-bundle

    ```
2. Enable the bundle in the kernel:

    ```
    // app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Dpn\XmlSitemapBundle\DpnXmlSitemapBundle(),
        );
    }
    ```
3. Register the routing in `app/config/routing.yml` *(this step is optional if using the console command to pre-generate the sitemaps)*

    ```
    DpnXmlSitemapBundle:
        resource: "@DpnXmlSitemapBundle/Resources/config/routing.xml"
    ```

Usage
-----

[](#usage)

### Exposing Routes

[](#exposing-routes)

To expose a route to the sitemap add the option `sitemap` to your route definition:

```
blog_index:
    path:      /blog
    defaults:  { _controller: AppBundle:Blog:index }
    options:
        sitemap: true
```

This will expose this route to your sitemap using the default options from your config. To control the options for this sitemap entry, add them to the `sitemap` option:

```
blog_index:
    path:      /blog
    defaults:  { _controller: AppBundle:Blog:index }
    options:
        sitemap:
                priority: 0.7
                changefreq: hourly
```

**NOTE**: Only routes without parameters may be exposed in this way. For routes with parameters, you must create a custom generator (see below).

### Custom Generator

[](#custom-generator)

For more complex routes that have parameters, you must create a custom generator.

1. Create a generator class that implements `Dpn\XmlSitemapBundle\Sitemap\GeneratorInterface`. This class must have a `generate()` method that returns an array of `Dpn\XmlSitemapBundle\Sitemap\Entry` objects.

    ```
    use Dpn\XmlSitemapBundle\Sitemap\Entry;
    use Dpn\XmlSitemapBundle\Sitemap\GeneratorInterface;

    class MySitemapGenerator implements GeneratorInterface
    {
        public function generate()
        {
            $entries = array();

            $entries[] = new Entry('http://example.com/foobar'); // must be absolute URL

            // add more entries - perhaps fetched from database

            return $entries;
        }
    }
    ```
2. Add this class as a service tagged with `dpn_xml_sitemap.generator`:

    ```
    services:
        my_sitemap_generator:
            class: MySitemapGenerator
            tags:
                - { name: dpn_xml_sitemap.generator }
    ```

### Sitemap Index

[](#sitemap-index)

According to [sitemaps.org](http://www.sitemaps.org/protocol.html#index) the maximum number of entries a `sitemap.xml`may have is 50,000. When the number of sitemap entries exceeds this, the entries are split across multiple sitemaps (ie `/sitemap1.xml`,`/sitemap2.xml`...`/sitemapN.xml`).

A sitemap index is accessible at `/sitemap_index.xml`.

The maximum entries per sitemap is configurable:

```
dpn_xml_sitemap:
    max_per_sitemap: 50000 #default
```

### HTTP Caching

[](#http-caching)

You can enable http caching for the `sitemap(n).xml`/`sitemap_index.xml` URI's by setting the number of seconds in your config:

```
dpn_xml_sitemap:
    http_cache: 3600
```

### Console Dump Command

[](#console-dump-command)

The `dpn:xml-sitemap:dump` command is available to pre-generate sitemap.xml files:

```
Usage:
 dpn:xml-sitemap:dump [--target="..."] host

Arguments:
 host      The full hostname for your website (ie http://www.google.com)

Options:
 --target  Override the target directory to dump sitemap(s) in

Help:
 Dumps your sitemap(s) to the filesystem (defaults to web/)

```

**NOTE**: The command requires Symfony 2.4+.

Full Default Configuration
--------------------------

[](#full-default-configuration)

The following is the default configuration for this bundle:

```
dpn_xml_sitemap:

    # The length of time (in seconds) to cache the sitemap/sitemap_index xml\'s (a reverse proxy is required)
    http_cache:      ~

    # The number of url entries in a single sitemap
    max_per_sitemap: 50000

    # The default options for sitemap URL entries to be used if not overridden
    defaults:

        # Value between 0.0 and 1.0 or null for sitemap protocol default
        priority:   ~

        # One of [always, hourly, daily, weekly, monthly, yearly, never] or null for sitemap protocol default
        changefreq: ~
```

License
-------

[](#license)

See `Resources/meta/LICENSE`.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% 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 ~147 days

Recently: every ~202 days

Total

11

Last Release

3434d ago

Major Versions

1.x-dev → v2.0.0-alpha12014-04-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/e98f22b5c566b4e7e0a0b8cae88e5841ec4053c5d1473d64e6e5b56116837b29?d=identicon)[bjo3rnf](/maintainers/bjo3rnf)

---

Top Contributors

[![kbond](https://avatars.githubusercontent.com/u/127811?v=4)](https://github.com/kbond "kbond (61 commits)")[![bitundpixel](https://avatars.githubusercontent.com/u/205191?v=4)](https://github.com/bitundpixel "bitundpixel (1 commits)")[![ronanguilloux](https://avatars.githubusercontent.com/u/313677?v=4)](https://github.com/ronanguilloux "ronanguilloux (1 commits)")

---

Tags

Sitemap

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

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

8.5k5.9M738](/packages/sylius-sylius)[prestashop/prestashop

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

9.1k17.8k](/packages/prestashop-prestashop)[chameleon-system/chameleon-base

The Chameleon System core.

1028.6k5](/packages/chameleon-system-chameleon-base)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)

PHPackages © 2026

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