2017 © Pedro Peláez
 

package sitemap-generator

A Basic sitemap generator generated by scraping

image

ashfaq1701/sitemap-generator

A Basic sitemap generator generated by scraping

  • Wednesday, November 23, 2016
  • by Md Ashfaq Salehin
  • Repository
  • 2 Watchers
  • 2 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Sitemap Generator

This package is a sitemap generator which generates XML sitemap for any given website dynamically. It generates sitemap by scraping all links from webpages recursively. But I tried to make it efficient by reducing the number of loops in least possible value., (*1)

Installation

You can install the package using composer., (*2)

composer require ashfaq1701/sitemap-generator

Usage

After installation using composer require the composer autoload file., (*3)

require 'vendor/autoload.php';

After this follow the steps below,, (*4)

use Ashfaq1701\SitemapGenerator\SitemapGenerator;

....

$sitemapGenerator = new SitemapGenerator($url, $path, $maximum);
$sitemap->generateSitemap();

It will generate the sitemap xml file in the file passed in $path variable. The maximum number of url's in the sitemap will be the number passed in $maximum., (*5)

A typical call will be like,, (*6)

$sitemapGenerator = new SitemapGenerator('https://www.venturepact.com', '/home/user/sitemap.xml', 2000);
$sitemap->generateSitemap();

The $path and $maximum parameters are not mandatory because they assume default values as $path='sitemap.xml' and $maximum=1000., (*7)

The generateSitemap() method not only writes the xml sitemap in the given directory but it also returns the sitemap XML as String. You can use this as following,, (*8)

$sitemapGenerator = new SitemapGenerator('https://www.venturepact.com', '/home/user/sitemap.xml', 2000);
$sitemapText = $sitemap->generateSitemap();
echo $sitemapText;

Improvements

If you have suggestions or need improvements please create issues or fork. Any improvements are more than welcome., (*9)

The Versions

23/11 2016

dev-master

9999999-dev

A Basic sitemap generator generated by scraping

  Sources   Download

MIT

by Avatar Md Ashfaq Salehin

23/11 2016

v1.0.0

1.0.0.0

A Basic sitemap generator generated by scraping

  Sources   Download

MIT

by Avatar Md Ashfaq Salehin