All Projects → ThePixelDeveloper → Sitemap

ThePixelDeveloper / Sitemap

Licence: mit
PHP XML Sitemap Generation

Projects that are alternatives of or similar to Sitemap

SitemapTools
A sitemap (sitemap.xml) querying and parsing library for .NET
Stars: ✭ 19 (-85.16%)
Mutual labels:  sitemap, xml
Sitemap Generator Crawler
Script that generates a sitemap by crawling a given URL
Stars: ✭ 169 (+32.03%)
Mutual labels:  sitemap, xml
Nextjs Sitemap Generator
Generate sitemap.xml from nextjs pages
Stars: ✭ 395 (+208.59%)
Mutual labels:  sitemap, xml
sitewriter
A rust library to generate sitemaps.
Stars: ✭ 18 (-85.94%)
Mutual labels:  sitemap, xml
Laravel Sitemap
Create and generate sitemaps with ease
Stars: ✭ 1,325 (+935.16%)
Mutual labels:  sitemap, xml
Graphquery
GraphQuery is a query language and execution engine tied to any backend service.
Stars: ✭ 112 (-12.5%)
Mutual labels:  xml
Binding.scala
Reactive data-binding for Scala
Stars: ✭ 1,539 (+1102.34%)
Mutual labels:  xml
Kripton
A Java/Kotlin library for Android platform, to manage bean's persistence in SQLite, SharedPreferences, JSON, XML, Properties, Yaml, CBOR.
Stars: ✭ 110 (-14.06%)
Mutual labels:  xml
Webapiclient
An open source project based on the HttpClient. You only need to define the c# interface and modify the related features to invoke the client library of the remote http interface asynchronously.
Stars: ✭ 1,618 (+1164.06%)
Mutual labels:  xml
Attentionxml
Implementation for "AttentionXML: Label Tree-based Attention-Aware Deep Model for High-Performance Extreme Multi-Label Text Classification"
Stars: ✭ 126 (-1.56%)
Mutual labels:  xml
Js2xml
Convert Javascript code to an XML document
Stars: ✭ 124 (-3.12%)
Mutual labels:  xml
Lemminx
XML Language Server
Stars: ✭ 117 (-8.59%)
Mutual labels:  xml
Repurrrsive
Recursive lists to use in teaching and examples, because there is no iris data for lists.
Stars: ✭ 112 (-12.5%)
Mutual labels:  xml
Saxerator
A SAX-based XML parser for parsing large files into manageable chunks
Stars: ✭ 119 (-7.03%)
Mutual labels:  xml
Bible Database
Bible databases as XML, JSON, SQL & SQLITE3 Database format for various languages. Developers can download it freely for their development works. Freely received, freely give.
Stars: ✭ 111 (-13.28%)
Mutual labels:  xml
Prettydiff
Beautifier and language aware code comparison tool for many languages. It also minifies and a few other things.
Stars: ✭ 1,635 (+1177.34%)
Mutual labels:  xml
Dotnet Transform Xdt
Modern .NET tools and library for XDT (Xml Document Transformation)
Stars: ✭ 110 (-14.06%)
Mutual labels:  xml
Twital
Twital is a "plugin" for Twig that adds some sugar syntax, which makes its templates similar to PHPTal or VueJS.
Stars: ✭ 116 (-9.37%)
Mutual labels:  xml
Snodge
Randomly mutate JSON, XML, HTML forms, text and binary data for fuzz testing
Stars: ✭ 121 (-5.47%)
Mutual labels:  xml
Fetch Plus
🐕 Fetch+ is a convenient Fetch API replacement with first-class middleware support.
Stars: ✭ 116 (-9.37%)
Mutual labels:  xml

Thepixeldeveloper\Sitemap

codecov License Latest Stable Version Total Downloads

A tool to generate XML sitemaps. Integrates with Symfony via SitemapBundle

Installation

composer require "thepixeldeveloper/sitemap"

Basic Usage

Generating a typical (<urlset>) sitemap.

<?php declare(strict_types=1);

use Thepixeldeveloper\Sitemap\Urlset;
use Thepixeldeveloper\Sitemap\Url;
use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;

$url = new Url($loc);
$url->setLastMod($lastMod);
$url->setChangeFreq($changeFreq);
$url->setPriority($priority);

$urlset = new Urlset();
$urlset->add($url);

$driver = new XmlWriterDriver();
$urlset->accept($driver);

echo $driver->output();

Generating a parent (<sitemapindex>) sitemap.

<?php declare(strict_types=1);

use Thepixeldeveloper\Sitemap\SitemapIndex;
use Thepixeldeveloper\Sitemap\Sitemap;
use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;

// Sitemap entry.
$url = new Sitemap($loc);
$url->setLastMod($lastMod);

// Add it to a collection.
$urlset = new SitemapIndex();
$urlset->add($url);

$driver = new XmlWriterDriver();
$urlset->accept($driver);

echo $driver->output();

Extensions

The following extensions are supported: Image, Link, Mobile, News and Video. They work in the following way (taking image as an example):

<?php declare(strict_types=1);

use Thepixeldeveloper\Sitemap\Urlset;
use Thepixeldeveloper\Sitemap\Url;
use Thepixeldeveloper\Sitemap\Extensions\Image;

$url = new Url($loc);
$url->setLastMod($lastMod);
$url->setChangeFreq($changeFreq);
$url->setPriority($priority);

$image = new Image('https://image-location.com');

$url->addExtension($image);

...

Advanced Usage

Processing Instructions

You can add processing instructions on the output as such.

<?php declare(strict_types=1);

use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;

$driver = new XmlWriterDriver();
$driver->addProcessingInstructions('xml-stylesheet', 'type="text/xsl" href="/path/to/xslt/main-sitemap.xsl"');

Which will add before the document starts.

<?xml-stylesheet type="text/xsl" href="/path/to/xslt/main-sitemap.xsl"?>

Comments

Comments are useful for information such as when the file was created.

<?php declare(strict_types=1);

use Thepixeldeveloper\Sitemap\Drivers\XmlWriterDriver;

$date = date('Y-m-d H:i:s');

$driver = new XmlWriterDriver();
$driver->addComment('This XML file was written on ' . $date . '. Bye!');

Which will render out.

<?xml version="1.0" encoding="UTF-8"?>
<!--This XML file was written on 2018-06-24 15:57:23. Bye!-->
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].