There is no license information available for the latest version (v1.0.1) of this package.

Generate static sitemap to server statically

v1.0.1 2015-10-29 01:54 UTC

This package is auto-updated.

Last update: 2022-08-12 14:03:40 UTC


Very simple sitemap (offline) generator.

How does it work?

Basically it receives an array or iterator (most of the time a cursor form your database) and a callback to format the URL.

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

use crodas\SitemapGenerator\SitemapGenerator;

$generator = new SitemapGenerator("", __DIR__ . "/public_html/sitemap/");

$generator = $generator->addMap(['foo', 'bar', 'xxx', 'yyy'], function($obj) {
    return new Multiple([
        '/1/' . $obj,
        '/2/' . $obj,
        '/3/' . $obj,
}, 'foobar.xml');

$generator = $generator->addMap($databaseResult, function($obj) {
    return $obj->url;
}, 'foobar.xml');