XML sitemap generation

Installs: 32 963

Dependents: 5

Stars: 26

Watchers: 4

Forks: 6

Open Issues: 4

Language: PHP

3.0.0 2014-09-01 22:43 UTC

README

Build Status

Sitemap is a tool to generate XML sitemaps quickly.

Usage

$basic = new \Sitemap\Sitemap\SitemapEntry('http://example.com/page-1');
$basic->setLastMod(time());

$collection = new \Sitemap\Collection;
$collection->addSitemap($basic);

// There's some different formatters available.
$collection->setFormatter(new \Sitemap\Formatter\XML\URLSet);
$collection->setFormatter(new \Sitemap\Formatter\XML\SitemapIndex);

$collection->output();

Output

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>http://example.com/page-1</loc>
        <lastmod>1359837115</lastmod>
    </url>
</urlset>

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>http://example.com/page-1</loc>
        <lastmod>1359837115</lastmod>
    </sitemap>
</urlset>