litlife/sitemap

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

Sitemap create module

0.0.1 2022-02-21 12:18 UTC

This package is auto-updated.

Last update: 2024-05-21 17:17:10 UTC


README

This package for create sitemap

Installation

Use the package manager composer to install.

composer require litlife/sitemap

Usage

Generate new sitemap and add new url

use Litlife\Sitemap\Sitemap;

$location = 'https://www.example.com';
$lastmod = '2005-01-01';
$changefreq = 'weekly';
$priority = 0.8;

$sitemap = new Sitemap();
$sitemap->addUrl($location, $lastmod, $changefreq, $priority);

Get an array with locations

$sitemap = new Sitemap();
$sitemap->getUrls();

Get xml string

$sitemap = new Sitemap();
$sitemap->getContent();

Get size of xml in bytes

$sitemap = new Sitemap();
$sitemap->getSize();

Get the number of locations in the current sitemap file

$sitemap = new Sitemap();
$sitemap->getUrlCount();

Get the number of locations in the current sitemap file

$sitemap = new Sitemap();
$sitemap->getUrlCount();

Open sitemap file

$sitemap = new Sitemap();
$sitemap->open('/path/to/file.xml');

Open sitemap index file

use Litlife\Sitemap\SitemapIndex;

$index = new SitemapIndex();
$index->open('/path/to/sitemap_index.xml');

Add a sitemap

$location = 'https://www.example.com/sitemap_index.xml';
$lastmod = '2005-01-01';

$index = new SitemapIndex();
$index->addSitemap($location, $lastmod);

Get the number of sitemaps

$index = new SitemapIndex();
$index->getSitemapsCount();

Get a list of sitemaps

$index = new SitemapIndex();
$index->getSitemaps();

Get the xml string of the sitemaps

$index = new SitemapIndex();
$index->getContent();

Testing

composer test

License

MIT