LaravelPackages.net
Acme Inc.
Toggle sidebar
ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

478.060
36
10.0.0
About ultrono/laravel-sitemap

ultrono/laravel-sitemap is a Laravel package for sitemap generator for laravel 11, 12 and 13. It currently has 36 GitHub stars and 478.060 downloads on Packagist (latest version 10.0.0). Install it with composer require ultrono/laravel-sitemap. Discover more Laravel packages by ultrono or browse all Laravel packages to compare alternatives.

Last updated

Packagist Version run-tests PHP ^8.2

Laravel Sitemap

This is a Laravel 11, 12 and 13 only fork of Laravelium/laravel-sitemap. The original repository has been abandoned.

The package supports actively supported Laravel releases as per the official Laravel Support Policy.

Installation

If laravelium/sitemap is already part of the project:

composer remove laravelium/sitemap

Then run:

composer require ultrono/laravel-sitemap
php artisan vendor:publish --provider="Ultrono\Sitemap\SitemapServiceProvider"

Generate a simple sitemap

Route::get('mysitemap', function() {
    $sitemap = resolve("sitemap");

    $sitemap->add(URL::to(), '2012-08-25T20:10:00+02:00', '1.0', 'daily');
    $sitemap->add(URL::to('page'), '2012-08-26T12:30:00+02:00', '0.9', 'monthly');

    $posts = DB::table('posts')->orderBy('created_at', 'desc')->get();

    foreach ($posts as $post) {
        $sitemap->add($post->slug, $post->modified, $post->priority, $post->freq);
    }

    // generate (format, filename)
    // sitemap.xml is stored within the public folder
    $sitemap->store('xml', 'sitemap');
});

Examples

and more in the Wiki.

Comments