Skip to content

a simple php tool to create sitemap for google bots

Notifications You must be signed in to change notification settings

arkdevuk/sitemap-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Total Downloads Latest Unstable Version License Made With

Sitemap-build

a simple tool to generate sitemaps for google's bots

USAGE

as simple as this :

<?php

namespace App;


require_once __DIR__ . '/../vendor/autoload.php';

use ArkdevukSitemapBuilder\classes\Sitemap;
use ArkdevukSitemapBuilder\classes\SitemapContainer;
use ArkdevukSitemapBuilder\classes\SitemapEntry;
use ArkdevukSitemapBuilder\classes\SitemapEntryImage;

$baseUrl = 'https://mywebsite.tld';

$container = new SitemapContainer($baseUrl, __DIR__.DIRECTORY_SEPARATOR.'example1');

$sitemap = new Sitemap('page');

$entry = new SitemapEntry();
$entry
    ->setLocation('/test')
    ->setChangeFrequency(SitemapEntry::CHANGE_WEEKLY)
    ->setPriority(1)
    ->setLastModDateTime(new \DateTime('2020-12-10'));

$media = new SitemapEntryImage($baseUrl.'/assets/images/image.jpeg');
$media
    ->setCaption('A test image for the purpose of the example')
    ->setGeoLocation('Aurillac, Cantal, France')
    ->setTitle('Image Title')//->setLicence('https://creativecommons.org/licenses/by-nc-nd/4.0/')
;

$entry->setMedia($media);

$sitemap->addEntry($entry);

$container->addSitemap($sitemap);


$container->compile();

About

a simple php tool to create sitemap for google bots

Resources

Stars

Watchers

Forks

Packages

No packages published