fuelviews / laravel-sitemap
Laravel sitemap package
Requires
- php: ^8.3
- spatie/crawler: ^8.4.0
- spatie/laravel-package-tools: ^1.92
- spatie/laravel-sitemap: ^7.3
Requires (Dev)
- driftingly/rector-laravel: ^2.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.2||^9.0.0||^8.22.0
- pestphp/pest: ^3.0||^2.34
- pestphp/pest-plugin-arch: ^3.0||^2.7
- pestphp/pest-plugin-laravel: ^3.2||^2.3
- rector/rector: ^2.0
- dev-main
- v0.0.17
- v0.0.16
- v0.0.15
- v0.0.14
- v0.0.13
- v0.0.12
- v0.0.11
- v0.0.10
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
- v0.0.1-RC2
- v0.0.1-RC1
- dev-dependabot/composer/composer-562d47c956
- dev-dependabot/composer/main/laravel/pint-1.22.0
- dev-dependabot/composer/main/spatie/laravel-package-tools-1.92.4
This package is auto-updated.
Last update: 2025-05-15 20:01:08 UTC
README
Laravel sitemap is a robust and easy-to-use solution designed to automatically generate sitemaps for your Laravel application.
Installation
You can require the package and it's dependencies via composer:
composer require fuelviews/laravel-sitemap
You can manually publish the config file with:
php artisan vendor:publish --provider="Fuelviews\Sitemap\SitemapServiceProvider" --tag="sitemap-config"
Usage
You can also add your models directly by implementing the Spatie\Sitemap\Contracts\Sitemapable interface. You also need to define your post_model in the fv-sitemap.php config file.
namespace App\Models; use Illuminate\Database\Eloquent\Model; use App\Contracts\Sitemapable; use Spatie\Sitemap\Tags\Url; class Post extends Model implements Sitemapable { /** * Convert the Post model instance into a sitemap URL entry. * * @return \Spatie\Sitemap\Tags\Url */ public function toSitemapUrl() { $url = Url::create(url("{$this->id}")) ->setLastModificationDate($this->updated_at) ->setChangeFrequency('daily') ->setPriority(0.8); return $url; } }
You can generate the sitemap with:
php artisan sitemap:generate
You can link to the sitemap with:
route('sitemap')
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
Support us
Fuelviews is a web development agency based in Portland, Maine. You'll find an overview of all our projects on our website.
License
The MIT License (MIT). Please see License File for more information.