Skip to content
This repository has been archived by the owner on Mar 2, 2023. It is now read-only.

Provides service for generating sitemap XML files and index of sitemap files.

License

Notifications You must be signed in to change notification settings

KEIII/SitemapServiceProvider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SitemapServiceProvider for Silex

Build Status

Provides sitemap-php service for Silex microframework.

Installation

composer require keiii/silex-sitemap

How to use

<?php

require_once __DIR__.'/vendor/autoload.php';

$app = new \Silex\Application();
$app->register(new \KEIII\SilexSitemap\SitemapServiceProvider(), array(
    'sitemap.domain' => 'http://example.com',
    'sitemap.path' => __DIR__,
    'sitemap.loc' => 'http://example.com/',
));

/** @var \KEIII\SilexSitemap\Sitemap $sitemap */
$sitemap = $app['sitemap'];

for ($i = 0; $i < 51000; $i++) {
    $item = (new \KEIII\SilexSitemap\SitemapItem())
        ->setLoc('/')
        ->setPriority(1.0)
        ->setChangefreq('daily')
        ->setLastmod(new \DateTime())
    ;
    $sitemap->addItem($item);
}

$sitemap->create();

When you run your script, it generates and saves XML files to given path.

About

Provides service for generating sitemap XML files and index of sitemap files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages