PHP code example of wish-cloud / laravel-sitemap

1. Go to this page and download the library: Download wish-cloud/laravel-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/ */

    

wish-cloud / laravel-sitemap example snippets


$sitemap = App::make('sitemap');
$sitemap->add('https://example.com/link1', Carbon::now(), '1.0', 'daily');
$sitemap->add('https://example.com/link2', '2022-02-17 13:26:37', '0.8', 'weekly');
return $sitemap->render('xml');


$sitemap = App::make('sitemap');
$sitemap->addSitemap('https://example.com/sitemap-category.xml');
$sitemap->addSitemap('https://example.com/sitemap-product.xml');
$sitemap->addSitemap('https://example.com/sitemap-article.xml');
return $sitemap->render('sitemapindex');
bash
php artisan vendor:publish --provider="WishCloud\LaravelSitemap\SitemapServiceProvider"