2017 © Pedro Peláez
 

library sitemap-generator

Sitemap Generator is PHP library to create sitemap.xml file on base html elements a-href in website.

image

janci/sitemap-generator

Sitemap Generator is PHP library to create sitemap.xml file on base html elements a-href in website.

  • Saturday, January 4, 2014
  • by janci
  • Repository
  • 1 Watchers
  • 6 Stars
  • 462 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 1 Open issues
  • 4 Versions
  • 1 % Grown

The README.md

Sitemap Generator

Sitemap Generator is PHP library to generate sitemap.xml from page link. Scan process searches a-href elements on the page and creates map with links (without links to external pages). Scanning can be used only for one page, when will gets links from the input link. Second option is using scanner to scan recursively. For this option scanner will scan all found links on website. Scanner accepts links starting with "/" or with domain name (website URL)., (*1)

Scanning process takes several minutes to build sitemap for bigger pages or with slower internet connection. The best practise is to run script from command line (CLI), not from website using web server., (*2)

Installation

The best way how to install Sitemap Generator is using Composer:, (*3)

php composer.phar require janci/sitemap-generator

Sitemap Generator requires PHP 5.3.0 or later., (*4)

Usage examples

To find all links on the website, use:, (*5)

    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    $urls = $siteMap->getFoundUrls();

To get result as sitemap.xml, use:, (*6)

    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    $sitemapXML = $siteMap->getSitemapContent();

    file_put_contents('sitemap.xml', $sitemapXML);

Previous two examples use recursive scanning (default). For single page scan is required to set "false" as second parameter of method SitemapGenerator::scanSite:, (*7)

    $siteMap = new SitemapGenerator();
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"), false);
    ...

To show progress information can be used handler function. Handler must be registered before calling scanSite method., (*8)

    $siteMap = new SitemapGenerator();
    $siteMap->onScanSite[] = function($siteMapGenerator, $scanDriver) {
        echo "{$siteMapGenerator->getProgressStatus()}%\n";
    };
    $siteMap->scanSite(new UrlScanDriver("http://www.example.com/"));
    ...

Thats' all!, (*9)

The Versions

04/01 2014

dev-master

9999999-dev

Sitemap Generator is PHP library to create sitemap.xml file on base html elements a-href in website.

  Sources   Download

GPL-3.0 BSD-3-Clause GPL-2.0

The Requires

 

The Development Requires

by Ing. Jan Svantner

generator sitemap scanner builder sitemap.xml

02/01 2014

v1.0-rc2

1.0.0.0-RC2

Generator to sitemap with scanner website based on html elements a.

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Ing. Jan Svantner

02/01 2014

v1.0-rc1

1.0.0.0-RC1

Generator to sitemap with scanner website based on html elements a.

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Ing. Jan Svantner

01/01 2014

v0.4

0.4.0.0

Generator to sitemap with scanner website based on html elements a.

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

by Ing. Jan Svantner