Skip to content
PHP Sitemaps & Sitemap Index Generator
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
Sitemap.php

README.md

php-sitemap-generator

PHP Sitemaps & Sitemap Index Generator

Requirements

Requires PHP5 with libxml PHP extension. The DOM extension uses UTF-8 encoding.

Installation

Download & Include Sitemap.php PHP Class File.

Example

$sitemap = new Sitemap();
$sitemap->baseurl = 'https://www.example.com';
$sitemap->target = '../';
$sitemap->limit = 10000;
$sitemap->add( '/index.html' );
$sitemap->add( '/about.html' );
$sitemap->add( '/news.html', '2016-09-10', 'daily', 0.7 );
$sitemap->generate();

Documentation

// Base Url of Sitemap Urls
public string $baseurl = 'https://example.com/'
// Save path of Sitemap File(s)
public string $target = './'
// Url limitation of Sitemap File(s)
public integer $limit = 25000
// Add URL to Sitemap 
public function add( url $loc, string $lastmod = '', string $changefreq = '', float $priority = ''  )

// Parameters
$loc // Relative Url (without baseurl) 
$lastmod // Date or Datetime string (any format) 
$changefreq // Sitemap Spec. [always|hourly|daily|weekly|monthly|yearly|never] 
$priority // Sitemap Spec. Must between 0.0 and 1.0
// Generate and Save Sitemap Files
public function generate( )
You can’t perform that action at this time.