webignition / website-sitemap-finder
Finds the sitemap(.xml) for a given website
Installs: 4 789
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 3
Open Issues: 0
Requires
- php: >=7.2.0
- guzzlehttp/guzzle: ~6
- webignition/absolute-url-deriver: >=3,<4
- webignition/robots-txt-file: >=2.0,<3
- webignition/web-resource-retriever: >=1,<2
Requires (Dev)
- phpstan/phpstan: ^0.11.5
- phpunit/phpunit: ^7
- squizlabs/php_codesniffer: ^3
README
Overview
Find the URLs for sitemaps for a given site. URLs are extracted from robots.txt. If none are present, sitemap.xml and sitemap.txt are assumed.
Usage
The "Hello World" example
<?php use webignition\WebsiteSitemapFinder\Configuration; use webignition\WebsiteSitemapFinder\WebsiteSitemapFinder; $configuration = new Configuration([ Configuration::KEY_ROOT_URL => 'http://google.com/', ]); $finder = new WebsiteSitemapFinder($configuration); $sitemapUrls = $finder->findSitemapUrls(); $this->assertEquals($sitemapUrls, [ 'http://www.gstatic.com/culturalinstitute/sitemaps/www_google_com_culturalinstitute/sitemap-index.xml', 'http://www.gstatic.com/s2/sitemaps/profiles-sitemap.xml', 'https://www.google.com/sitemap.xml', ]);
Building
Using as a library in a project
If used as a dependency by another project, update that project's composer.json and update your dependencies.
"require": {
"webignition/website-sitemap-finder": "*"
}
Developing
This project has external dependencies managed with composer. Get and install this first.
# Make a suitable project directory
mkdir ~/website-sitemap-finder && cd ~/website-sitemap-finder
# Clone repository
git clone git@github.com:webignition/website-sitemap-finder.git.
# Retrieve/update dependencies
composer.phar install
Testing
Have look at the project on travis for the latest build status, or give the tests a go yourself.
cd ~/website-sitemap-finder
composer.phar test