Download the PHP package safaeean/laravel-sitemap without Composer
On this page you can find all versions of the php package safaeean/laravel-sitemap. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download safaeean/laravel-sitemap
More information about safaeean/laravel-sitemap
Files in safaeean/laravel-sitemap
Package laravel-sitemap
Short Description Create and generate sitemaps with ease
License MIT
Homepage https://github.com/safaeean/laravel-sitemap
Informations about the package laravel-sitemap
Generate sitemaps with ease
This package can generate a sitemap without you having to add urls to it manually. This works by crawling your entire site.
You can also create your sitemap manually:
Or you can have the best of both worlds by generating a sitemap and then adding more links to it:
Postcardware
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciated you sending us postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: safaeean, Samberstraat 69D, 2060 Antwerp, Belgium.
All postcards are published on our website.
Installation
First, install the package via composer:
Next up: installing the service provider
If you want to update your sitemap automatically and frequently you need to perform some extra steps.
Configuration
You can override the default options for the crawler. First publish the configuration:
This will copy the default config to config/sitemap.php
where you can edit it.
Usage
Generating a sitemap
The easiest way is to crawl the given domain and generate a sitemap with all found links.
The destination of the sitemap should be specified by $path
.
The generated sitemap will look similiar to this:
Customizing the sitemap generator
Changing properties
To change the lastmod
, changefreq
and priority
of the contact page:
Leaving out some links
If you don't want a crawled link to appear in the sitemap, just don't return it in the callable you pass to hasCrawled
.
Preventing the crawler from crawling some pages
You can also instruct the underlying crawler to not crawl some pages by passing a callable
to shouldCrawl
.
Manually adding links
You can manually add links to a sitemap:
Adding alternates to links
Multilingual sites may have several alternate versions of the same page (one per language). Based on the previous example adding an alterante can be done as follows:
Note the function which takes an alternate URL and the locale it belongs to.
Manually creating a sitemap
You can also create a sitemap fully manual:
Creating a sitemap index
You can create a sitemap index:
You can pass a safaeean\Sitemap\Tags\Sitemap
object to manually set the lastModificationDate
property.
the generated sitemap index will look similar to this:
Generating the sitemap frequently
Your site will probably be updated from time to time. In order to let your sitemap reflect these changes you can run the generator periodically. The easiest way of doing this is do make use of Laravel's default scheduling capabilities.
You could setup an artisan command much like this one:
That command should then be scheduled in the console kernel.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
First start the test server in a seperate terminal session:
With the server running you can execute the tests:
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Freek Van der Herten
- All Contributors
About safaeean
safaeean is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-sitemap with dependencies
illuminate/support Version ~5.5.0|~5.6.0
nesbot/carbon Version ^1.21
spatie/crawler Version ^4.0.3
spatie/temporary-directory Version ^1.1