octave/sitemap-bundle

Symfony sitemap generator
27,075
Install
composer require octave/sitemap-bundle
Latest Version:2.1.0
PHP:>=7.0.1
License:MIT
Last Updated:Feb 10, 2025
Links: GitHub  ·  Packagist
Maintainer: deadkash

Octave Sitemap Bundle

Installation

Step 1: Download OctaveSitemapBundle using composer

Require the bundle

"require": {
    ... some repositories
    "octave/sitemap-bundle": "^1.0.0"
}

And run composer update.

Step 2: Enable the bundle

Enable the bundle in the kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Octave\SitemapBundle\OctaveSitemapBundle(),
        // ...
    );
}

Step 3: Implement your sitemap source

<?php

namespace AppBundle\Service;

use Octave\SitemapBundle\Service\SourceInterface;
use Octave\SitemapBundle\Model\Item;

class AppSitemapSource implements SourceInterface
{
    public function getItems()
    {
        return [
            new Item('http://mysite.com/', new \DateTime(), Item::FREQ_ALWAYS, 1.0)    
        ];
    }
}

Step 4: Configure source service

# app/config/services.yml

services:
    
    app.sitemap.source:
        class: AppBundle\Service\AppSitemapSource
        tags:
            - { name: 'octave.sitemap.source' }