mkebza / sitemap-bundle
Symfony bundle generating sitemaps
Installs: 200
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1.3
- elao/enum: ^1.5
- symfony/config: ~3.4|~4.0
- symfony/console: ~3.4|~4.0
- symfony/dependency-injection: ~3.4|~4.0
- symfony/event-dispatcher: ~3.4|~4.0
- symfony/filesystem: ~3.4|~4.0
Requires (Dev)
- symfony/phpunit-bridge: ^4.1
This package is auto-updated.
Last update: 2025-03-15 17:18:36 UTC
README
Instalation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require mkebza/sitemap-bundle
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require mkebza/sitemap-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new MKebza\Sitemap\MKebzaSitemapBundle(), ); // ... } // ... }
Configuration
there is only one available configuration and that is base_url
, its automatically prepended
to all url if they aren't fully quilified.
m_kebza_sitemap: base_url: http://www.example.com
Usage
Collecting routes works by implementing MKebza\Sitemap\Service\SitemapLocationGeneratorInterface
which is then autoconfigured via symfony container. If you don't use autoconfiguration, you
need to tag your service with mkebza_sitemap.generator
tag to be used.
SitemapLocationGeneratorInterface
Has one method generate()
which is generator and needs to yield object of
MKebza\Sitemap\Service\Location
.
Location
You can either use absolute url or relative URL, which will be prepended by url set in your configuration.
Generating sitemap
From your terminal run bin/console sitemap:generate
, default path is public/sitemap.xml
,
but you can change it by passig path as first argument to the command.
You need to put this command to you cron / scheduler to generate sitemap on regular basis.