Downloads
Stars
Version
This package helps you create a sitemap in your project. The Laravel facade allows you to add or remove urls from your sitemap at the location of your choice.
First, install the package via composer:
composer require curlychoi/laravel-sitemap
The package will automatically register a service provider and alias.
And to create a database to store sitemap urls, publish the migration files and run the migrate.
php artisan vendor:publish --provider="Curlychoi\LaravelSitemap\Providers\SitemapServiceProvider" --tag=migrations
php artisan migrate
$url = request()->getSchemeAndHttpHost() . '/posts/1';
Sitemap::put($url);
$url = request()->getSchemeAndHttpHost() . '/posts/1';
Sitemap::forget($url);
https://your-domain.com/sitemap.xml
This sitemap.xml is compliant with the sitemaps protocol.
With the server running you can execute the tests:
$ composer test
The MIT License (MIT). Please see License File for more information.