PHP code example of pecotamic / sitemap

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

    

pecotamic / sitemap example snippets


use Pecotamic\Sitemap\Sitemap;
use Pecotamic\Sitemap\SitemapEntry;

class AppServiceProvider extends Provider
{
    public function boot()
    {
        Sitemap::addEntries(static function () {
            return [
                new SitemapEntry('/hidden-page', new \DateTime('2020-02-20')),
                new SitemapEntry('/about-me', new \DateTime('now'), 'daily', '1.0'),
            ];
        });
    }
}

php artisan vendor:publish --provider="Pecotamic\Sitemap\ServiceProvider" --tag=config

php artisan vendor:publish --provider="Pecotamic\Sitemap\ServiceProvider" --tag=view