PHP code example of alt-design / alt-sitemap

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

    

alt-design / alt-sitemap example snippets


$this->callAfterResolving(
    AltSitemapController::class,
    function ($altSitemapController) {
        $altSitemapController->registerItem(
            [
                '/url-1',
            ]
        );
    }
);

$this->callAfterResolving(
     AltSitemapController::class,
     function ($altSitemapController) {
         $altSitemapController->registerItems(
             [
                 [
                     '/url-1',
                 ],
                 [
                     '/url-2',
                     Carbon::create(2024,10,23,12,20,0, 'UTC'),
                 ],
                 [
                     '/url-3',
                     Carbon::create(2024,10,23,12,20,0, 'UTC'),
                     0.8
                 ],
             ]
         );
     }
 );