PHPackages                             spatie/laravel-sitemap - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. spatie/laravel-sitemap

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

spatie/laravel-sitemap
======================

Create and generate sitemaps with ease

8.1.0(2mo ago)2.6k14.6M—10%29820MITPHPPHP ^8.4CI passing

Since Aug 15Pushed 4w ago33 watchersCompare

[ Source](https://github.com/spatie/laravel-sitemap)[ Packagist](https://packagist.org/packages/spatie/laravel-sitemap)[ Docs](https://github.com/spatie/laravel-sitemap)[ Fund](https://spatie.be/open-source/support-us)[ RSS](/packages/spatie-laravel-sitemap/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (25)Versions (83)Used By (20)

 [   ![Logo for laravel-sitemap](https://camo.githubusercontent.com/90cac106d0da71a0b926c964b3aec5f649cad58f605632da37b760fd817c42aa/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d736974656d61702f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-sitemap)Generate sitemaps with ease
===========================

[](#generate-sitemaps-with-ease)

[![Latest Version on Packagist](https://camo.githubusercontent.com/88bfde272b18b434ba0112ed83db106ec6241140702a7c70dc3f46300d738146/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d736974656d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-sitemap)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Test Status](https://camo.githubusercontent.com/930ae1d8d825b3cbb70e52ab4e9228751c0a0bcdf7eb1447efa29ca4bcfe62f3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d736974656d61702f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/spatie/laravel-sitemap/actions/workflows/run-tests.yml)[![Code Style Status](https://camo.githubusercontent.com/31ea5ca32be0d19b131879cf5c9fa623aaac2cd0de5d71f7fff4fab0df9595ba/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d736974656d61702f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6c6162656c3d636f64652532307374796c65)](https://github.com/spatie/laravel-sitemap/actions/workflows/fix-php-code-style-issues.yml)[![PHPStan](https://camo.githubusercontent.com/56b17787f58226508f3075b0d4ff747ba0dbccaa8930806af1254f346d694b25/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d736974656d61702f7068707374616e2e796d6c3f6c6162656c3d5048505374616e)](https://github.com/spatie/laravel-sitemap/actions/workflows/phpstan.yml)[![Total Downloads](https://camo.githubusercontent.com/7df68800620b7449bd11d4be7273456d279b63ec1c504041efb002706668a284/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d736974656d61702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-sitemap)

This package can generate a sitemap without you having to add URLs to it manually. This works by crawling your entire site.

```
use Spatie\Sitemap\SitemapGenerator;

SitemapGenerator::create('https://example.com')->writeToFile($path);
```

You can also create your sitemap manually:

```
use Carbon\Carbon;
use Spatie\Sitemap\Sitemap;
use Spatie\Sitemap\Tags\Url;

Sitemap::create()
    ->add(Url::create('/home')
        ->setLastModificationDate(Carbon::yesterday()))
    ->add(...)
    ->writeToFile($path);
```

Or you can have the best of both worlds by generating a sitemap and then adding more links to it:

```
use Spatie\Sitemap\SitemapGenerator;
use Spatie\Sitemap\Tags\Url;

SitemapGenerator::create('https://example.com')
    ->getSitemap()
    ->add(Url::create('/extra-page')
        ->setLastModificationDate(Carbon::yesterday()))
    ->add(...)
    ->writeToFile($path);
```

You can also add your models directly by implementing the `Sitemapable` interface.

```
use Spatie\Sitemap\Contracts\Sitemapable;
use Spatie\Sitemap\Tags\Url;

class Post extends Model implements Sitemapable
{
    public function toSitemapTag(): Url | string | array
    {
        return route('blog.post.show', $this);
    }
}
```

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/a1b18bf42ae6dc175e8ce4bc65f99fc532385ec97d4aacfe2c0df058ff87b00e/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d736974656d61702e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-sitemap)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

All documentation is available [on our documentation site](https://spatie.be/docs/laravel-sitemap).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

81

—

ExcellentBetter than 100% of packages

Maintenance90

Actively maintained with recent releases

Popularity75

Solid adoption and visibility

Community51

Growing community involvement

Maturity96

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 63.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Recently: every ~26 days

Total

81

Last Release

68d ago

Major Versions

3.3.1 → 4.02018-02-08

4.0 → 5.0.02018-03-02

5.9.2 → 6.0.02021-03-12

6.4.0 → 7.0.02023-10-24

7.4.0 → 8.0.02026-02-21

PHP version history (9 changes)0.0.1PHP ^7.0

4.0PHP ^7.1

5.3.0PHP ^7.2

5.9.0PHP ^7.4|^8.0

6.0.0PHP ^8.0

7.1.0PHP ^8.2

7.3.0PHP ^8.2||^8.3||^8.4

7.4.0PHP ^8.2||^8.3||^8.4||^8.5

8.0.1PHP ^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (235 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (9 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (9 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (8 commits)")[![ManuDoni](https://avatars.githubusercontent.com/u/10022459?v=4)](https://github.com/ManuDoni "ManuDoni (6 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (5 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 commits)")[![emanuelmutschlechner](https://avatars.githubusercontent.com/u/27734375?v=4)](https://github.com/emanuelmutschlechner "emanuelmutschlechner (3 commits)")[![BrentRobert](https://avatars.githubusercontent.com/u/6866325?v=4)](https://github.com/BrentRobert "BrentRobert (3 commits)")[![jimirobaer](https://avatars.githubusercontent.com/u/8984769?v=4)](https://github.com/jimirobaer "jimirobaer (2 commits)")[![king724](https://avatars.githubusercontent.com/u/350488?v=4)](https://github.com/king724 "king724 (2 commits)")[![madman-81](https://avatars.githubusercontent.com/u/50033071?v=4)](https://github.com/madman-81 "madman-81 (2 commits)")[![Akilez](https://avatars.githubusercontent.com/u/2991685?v=4)](https://github.com/Akilez "Akilez (2 commits)")[![davidbonting](https://avatars.githubusercontent.com/u/6029739?v=4)](https://github.com/davidbonting "davidbonting (2 commits)")[![Briareos17](https://avatars.githubusercontent.com/u/2332158?v=4)](https://github.com/Briareos17 "Briareos17 (2 commits)")[![bakerkretzmar](https://avatars.githubusercontent.com/u/18192441?v=4)](https://github.com/bakerkretzmar "bakerkretzmar (2 commits)")[![pascalbaljet](https://avatars.githubusercontent.com/u/8403149?v=4)](https://github.com/pascalbaljet "pascalbaljet (2 commits)")

---

Tags

googlelaravelphpseositemapxmlspatielaravel-sitemap

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/spatie-laravel-sitemap/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-laravel-sitemap/health.svg)](https://phpackages.com/packages/spatie-laravel-sitemap)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[spatie/laravel-health

Monitor the health of a Laravel application

86910.0M83](/packages/spatie-laravel-health)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
