PHPackages                             kfoobar/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kfoobar/laravel-sitemap

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kfoobar/laravel-sitemap
=======================

A Laravel package for generating sitemaps

v1.0.0(1y ago)037MITPHPPHP &gt;=7.4

Since Feb 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/KFoobar/laravel-sitemap)[ Packagist](https://packagist.org/packages/kfoobar/laravel-sitemap)[ RSS](/packages/kfoobar-laravel-sitemap/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Laravel Sitemap Generator
=========================

[](#laravel-sitemap-generator)

A Laravel package for generating sitemaps in your application.

By default, the package generates a `sitemap.xml` file, but you can choose to group links into different sitemaps. If you organize URLs into multiple groups or exceed the limit set in the configuration, the package will automatically create multiple sitemap files along with an index sitemap to reference them.

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require kfoobar/laravel-sitemap
```

Publish the configuration file:

```
php artisan vendor:publish --provider="KFoobar\Sitemap\SitemapServiceProvider"
```

Configuration
-------------

[](#configuration)

The configuration file `config/sitemap.php` allows you to set:

- **path**: The directory in the public folder where the sitemaps will be stored.
- **size**: The maximum number of URLs per sitemap file (default is 25000).

Usage
-----

[](#usage)

This package provides two functions: **add()** and **generate()**.

**add()** accepts three parameters:

- **url**, URL of the page.
- **lastModified**, indicating when the page was last updated.
- **group**, allowing you to group URLs to create multiple sitemaps.

The **generate()** function creates the sitemap file based on the added URLs.

Note: The **priority** and **frequency** fields are not used because Google does not consider these values.

### Using the Facade

[](#using-the-facade)

Add URLs and generate the sitemap using the Facade:

```
use KFoobar\Sitemap\Facades\Sitemap;

Sitemap::add('https://example.com', now(), 'default');
Sitemap::generate();
```

### Manually Instantiating the Class

[](#manually-instantiating-the-class)

You can also instantiate the SitemapFactory class manually. This approach gives you direct control over the instance.

```
use KFoobar\Sitemap\SitemapFactory;

(new SitemapFactory)
    ->add('https://example.com')
    ->add('https://example.com/about')
    ->generate();
```

### Example

[](#example)

```
use KFoobar\Sitemap\SitemapFactory;

$sitemap = new SitemapFactory;

foreach (Post::all() as $post) {
    $url = route('posts.show', $post);
    $lastModified = $post->updated_at->toIso8601String();

    $sitemap->add($url, $lastModified);
}

$sitemap->generate();
```

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

[](#contributing)

Contributions are welcome!

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance40

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

504d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/420690?v=4)[David Villa](/maintainers/KFoobar)[@KFoobar](https://github.com/KFoobar)

---

Top Contributors

[![KFoobar](https://avatars.githubusercontent.com/u/420690?v=4)](https://github.com/KFoobar "KFoobar (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[flarum/core

Delightfully simple forum software.

201.4M2.2k](/packages/flarum-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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