PHP code example of lemaur / laravel-image-sitemap

1. Go to this page and download the library: Download lemaur/laravel-image-sitemap library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lemaur / laravel-image-sitemap example snippets


use Carbon\Carbon;
use Lemaur\Sitemap\Sitemap;
use Lemaur\Sitemap\Tags\Image;
use Lemaur\Sitemap\Tags\Url;

Sitemap::create()

    ->add(Url::create('/home')
        ->setLastModificationDate(Carbon::yesterday())
        ->setChangeFrequency(Url::CHANGE_FREQUENCY_YEARLY)
        ->setPriority(0.1)
        ->addImage('/url/to/images.jpg')
        ->addImage(
            Image::create('/url/to/another-image.jpg')
                ->setTitle('Image Title')
                ->setCaption('Image Alt Text')
                ->setGeoLocation('Image Geo Location')
                ->setLicense('https://url/to/the/license')
        ))

   ->add(...)

   ->writeToFile($path);
bash
php artisan vendor:publish --provider="Lemaur\Sitemap\SitemapServiceProvider" --tag="laravel_image_sitemap-config"