a3020 / laravel-sitemap
Retrieves, validates, and parses remote sitemap documents
1.0.1
2018-04-01 12:06 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- illuminate/support: 5.6
- phpunit/phpunit: ^6.5
This package is auto-updated.
Last update: 2024-11-09 22:08:00 UTC
README
Installation
composer require a3020/laravel-sitemap
Usage
Retrieve urls from a single sitemap
$client = $app->make('sitemap.client'); $urls = $client->get(['https://somedomain.com/sitemap.xml']);
Retrieve urls from sitemaps + sitemaps from robots.txt
$client = $app->make('sitemap.client'); $urls = $client->get(['https://somedomain.com/sitemap.xml'], 'https://somedomain.com/robots.txt');
Validate a sitemap
$validator = $app->make('sitemap.validator'); $validator->validate($contents);
Parse a sitemap
$parser = $app->make('sitemap.parser'); // Return URLs found in sitemap document $parser->urls($contents); // Filter to only get portfolio URLs. $parser->filterUrlsByRegexes($contents, ['/portfolio']);