tahsingokalp / laravel-sitemap
Sitemap generator for Laravel
v11.0.2
2024-03-22 21:35 UTC
Requires
- php: ^8.0
- illuminate/filesystem: ^8.0 || ^9.0 || ^10.0 || ^11.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0 || ^11.0
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/framework: ^8.0 || ^9.0 || ^10.0 || ^11.0
- laravel/pint: ^1.14
- orchestra/testbench: ^9.0.0||^8.22.0
- orchestra/testbench-core: ^6.0 || ^7.0 || ^8.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- php-coveralls/php-coveralls: ^2.2
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-12-22 23:11:12 UTC
README
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
- How to generate dynamic sitemap (with optional caching)
- How to generate BIG sitemaps (with more than 1M items)
- How to generate sitemap to a file
- How to use multiple sitemaps with sitemap index
and more in the Wiki.