octave/sitemap-bundle

Symfony sitemap generator

Installs: 16 841

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

2.0.3 2022-11-22 12:50 UTC

This package is auto-updated.

Last update: 2024-11-22 18:16:15 UTC


README

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' }