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

Sitemap generator for Laravel

464
1
V12.0.0
About tahsingokalp/laravel-sitemap

tahsingokalp/laravel-sitemap is a Laravel package for sitemap generator for laravel. It currently has 1 GitHub stars and 464 downloads on Packagist (latest version V12.0.0). Install it with composer require tahsingokalp/laravel-sitemap. Discover more Laravel packages by tahsingokalp or browse all Laravel packages to compare alternatives.

Last updated

Packagist Version run-tests PHP ^8.0

Laravel Sitemap

This is a Laravel 8, 9 and 10 only fork of Laravelium/laravel-sitemap. The original repository has been abandoned.

PHP ^8.0 is required.

Installation

If laravelium/sitemap is already part of the project:

composer remove laravelium/sitemap

Then run:

composer require tahsingokalp/laravel-sitemap
php artisan vendor:publish --provider="TahsinGokalp\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.

Star History Chart