a3020/laravel-sitemap

Retrieves, validates, and parses remote sitemap documents

1.0.1 2018-04-01 12:06 UTC

This package is auto-updated.

Last update: 2022-09-09 17:39:40 UTC


README

Build Status Software License

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']);