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
Requires
- php: ^8.0
- ext-dom: *
- ext-libxml: *
- nesbot/carbon: ^2.57
Requires (Dev)
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2025-02-21 19:12:35 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