Download the PHP package mfonte/laravel-sitemap without Composer
On this page you can find all versions of the php package mfonte/laravel-sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mfonte/laravel-sitemap
More information about mfonte/laravel-sitemap
Files in mfonte/laravel-sitemap
Package laravel-sitemap
Short Description Laravel Sitemap Generator. Supports SitemapIndex, Images Sitemap and News Sitemap.
License MIT
Homepage https://github.com/mauriziofonte/laravel-sitemap
Informations about the package laravel-sitemap
Generate sitemaps with Laravel (or for a Non-Laravel project), compatible with Images Sitemap and News Sitemap
This package has been forked from spatie/laravel-sitemap, to remove support for SitemapGenerator
, remove installation requirement for PHP 8, and add support for Images Sitemaps and News Sitemaps.
Additionally, this package adds support for installation outside a Laravel Project. See Using this package outside Laravel section.
This package can generate a valid sitemap by writing your own custom logic for the sitemap structure, via the API provided by this package.
Heads up! This package requires Laravel 9 or Laravel 10 For PHP 7.4 and Laravel 8 compatibility refer to v1.1.*
Installation
For Laravel 9 or 10, or for a non-Laravel-based project running on PHP >= 8.0
composer require mfonte/laravel-sitemap
For Laravel 8, or for a non-Laravel-based project running on PHP >= 7.4 && < 8.0
composer require mfonte/laravel-sitemap "^1.1"
Creating sitemaps
You can only create your sitemap manually:
The sitemap generator can automatically understand what type of items you placed inside the sitemap, and create a valid schema accordingly. This is an example of a sitemap header with images and news:
You can also add your models directly by implementing the \Mfonte\Sitemap\Contracts\Sitemapable
interface.
Now you can add a single post model to the sitemap or even a whole collection.
This way you can add all your pages super fast without the need to crawl them all.
Creating a sitemap index
You can create a sitemap index:
You can pass a Mfonte\Sitemap\Tags\Sitemap
object to manually set the lastModificationDate
property.
the generated sitemap index will look similar to this:
Usage outside of Laravel
The same instructions above apply, except for:
- You can not use
Contracts\Sitemapable
to extend a Model (you're not on Laravel, aren't you?) - You have to use the
Sitemap::render()
,Sitemap::writeToFile()
,SitemapIndex::render()
andSitemapIndex::writeToFile()
via providing the extra boolean flag$nativeRenderer = true
- You can not use
Sitemap::writeToDisk()
,Sitemap::toResponse()
,SitemapIndex::writeToDisk()
andSitemapIndex::toResponse()
So, for example, a basic approach may be:
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Credits
- Original package published by Spatie
- Freek Van der Herten
- All Contributors
License
The MIT License (MIT). Please see https://github.com/spatie/laravel-sitemap and the relative license file has been migrated into this repository as-it-is.
All versions of laravel-sitemap with dependencies
illuminate/support Version ^9.0 || ^10.0
illuminate/contracts Version ^9.0 || ^10.0
nesbot/carbon Version ^2.0
spatie/laravel-package-tools Version ^1.14