digit7s / laravel-seo-sitemap
Reusable Laravel SEO sitemap abstraction for Laravel applications.
v1.0.0
2026-08-28 15:46 UTC
Requires
- php: ^8.4
- illuminate/support: ^12.0|^13.0
- spatie/laravel-package-tools: ^1.16.1
- spatie/laravel-sitemap: ^8.2
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.13
- orchestra/testbench: ^10.0|^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-type-coverage: ^4.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-phpunit: ^2.0
README
digit7s/laravel-seo-sitemap is a reusable Laravel package for SEO sitemap generation across Laravel applications.
The package uses spatie/laravel-sitemap as the underlying sitemap engine and provides an application-focused abstraction layer that can grow without coupling consuming applications to Filament, Inertia, Vue, project-specific Eloquent models, route names, locale models, or database schemas.
Requirements
- PHP 8.4 or higher
- Laravel 12 or 13
Installation
composer require digit7s/laravel-seo-sitemap
Publish the configuration when you need to customize the package defaults:
php artisan vendor:publish --tag=seo-sitemap-config
Quick Start
- Implement an application sitemap definition:
namespace App\Sitemap; use Digit7s\SeoSitemap\Contracts\SitemapDefinition; use Digit7s\SeoSitemap\Sitemap\SitemapBuilder; use Digit7s\SeoSitemap\Sitemap\SitemapManager; final class WebsiteSitemap implements SitemapDefinition { public function build(SitemapManager $manager): SitemapBuilder { return $manager ->createBuilder() ->addUrl('/') ->addUrl('about') ->addRoute('contact'); } }
- Bind
SitemapDefinitionin yourAppServiceProvider:
use App\Sitemap\WebsiteSitemap; use Digit7s\SeoSitemap\Contracts\SitemapDefinition; public function register(): void { $this->app->bind(SitemapDefinition::class, WebsiteSitemap::class); }
- Generate the sitemap:
php artisan sitemap:generate
- (Optional) Schedule generation in
routes/console.php:
use Illuminate\Support\Facades\Schedule; Schedule::command('sitemap:generate') ->daily() ->withoutOverlapping();
Documentation
- Introduction
- Installation
- Configuration
- Architecture
- Testing
- Sitemap Definition
- Sitemap Generation
- Automation & Concurrency
- Large Sitemaps & Splitting
- Sitemap Indexes
- Static URLs and Named Routes
- Sitemap Sources
- Dynamic Content
- URL Filtering
- Canonical URLs
- Localization
- hreflang Alternates
- Image Sitemaps
- Custom Alternate Resolvers
- Custom Sources
- Public API Reference
- Release Guide
Testing
composer validate --strict
composer test
composer analyse
composer format
License
The MIT License. See LICENSE.md.