PHPackages                             mohammad-zarifiyan/laravel-sitemap-manager - 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. mohammad-zarifiyan/laravel-sitemap-manager

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

mohammad-zarifiyan/laravel-sitemap-manager
==========================================

A Laravel package for managing sitemaps.

3.0.6(4mo ago)077↓93.3%PHPPHP &gt;=8.1

Since Feb 1Pushed 3mo agoCompare

[ Source](https://github.com/MohammadZarifiyan/Laravel-Sitemap-Manager)[ Packagist](https://packagist.org/packages/mohammad-zarifiyan/laravel-sitemap-manager)[ RSS](/packages/mohammad-zarifiyan-laravel-sitemap-manager/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

Introduction
============

[](#introduction)

**Sitemap Manager** is a Laravel package for automated sitemap generation and management. It creates new sitemap files, replaces outdated ones, and keeps everything up to date using a single Artisan command and Laravel’s scheduler.

Ideal for Laravel applications that need **reliable, repeatable, and automated sitemap handling**.

Installation
============

[](#installation)

Install the package via Composer:

```
composer require mohammad-zarifiyan/laravel-sitemap-manager:^3.0
```

Database Migrations
-------------------

[](#database-migrations)

This package stores sitemap metadata in the database.

Publish and run the migrations:

```
php artisan vendor:publish --provider="MohammadZarifiyan\LaravelSitemapManager\Providers\SitemapManagerProvider" --tag="sitemap-manager-migrations"
```

```
php artisan migrate
```

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

[](#configuration)

To publish the configuration file:

```
php artisan vendor:publish --provider="MohammadZarifiyan\LaravelSitemapManager\Providers\SitemapManagerProvider" --tag="sitemap-manager-config"
```

Routes
------

[](#routes)

Register the package routes in your `routes/web.php` file:

```
use Illuminate\Support\Facades\Route;

Route::sitemap();
```

This code registers sitemap serving routes.

Scheduling
----------

[](#scheduling)

To keep sitemaps updated automatically, register the command in Laravel’s scheduler:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('sitemap-manager:refresh-sitemaps')->daily();
```

Make sure your server cron is configured to run Laravel’s scheduler.

How It Works
============

[](#how-it-works)

1. Sitemap data is collected from all registered registries.
2. Sitemap files are generated in chunks based on the configured `tags-per-sitemap` limit.
3. Existing sitemap files are safely replaced with the new ones.
4. Metadata about generated sitemaps is stored in the database.
5. Your sitemaps are served dynamically at the `/sitemap.xml` path, automatically adapting to your domain.

Creating a Custom Sitemap Registry
==================================

[](#creating-a-custom-sitemap-registry)

Sitemap Manager allows you to **add your own data** sources by implementing the `MohammadZarifiyan\LaravelSitemapManager\Interfaces\RegistryInterface` or `MohammadZarifiyan\LaravelSitemapManager\Interfaces\RestrictedRegistryInterface`. This document explains how to create a custom registry, handle pagination, and register it in the configuration.

1. Implement `RegistryInterface`
--------------------------------

[](#1-implement-registryinterface)

Create a new class that implements `MohammadZarifiyan\LaravelSitemapManager\Interfaces\RegistryInterface`:

```
