1. Go to this page and download the library: Download clacy-builders/xml 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/ */
clacy-builders / xml example snippets
\ClacyBuilders\Xml;
class Kml extends Xml
{
const MIME_TYPE = 'application/vnd.google-earth.kml+xml';
const FILENAME_EXTENSION = 'kml';
const XML_NAMESPACE = 'http://www.opengis.net/kml/2.2';
public static function createKml()
{
return static::createRoot('kml');
}
public function placemark($name, $description, $longitude, $latitude, $altitude = 0)
{
$pm = $this->append('Placemark');
$pm->append('name', $name);
$pm->append('description', $description);
$pm->append('Point')
->append('coordinates', $longitude . ',' . $latitude . ',' . $altitude);
return $pm;
}
}
$myKml = Kml::createKml();
$myKml->placemark('Cologne Cathedral',
'Cologne Cathedral is a Roman Catholic cathedral in Cologne, Germany.',
'50.9413', '6.958');
$myKml->headerfields('cologne-cathedral');
print $myKml;
\ClacyBuilders\Xml;
use \ClacyBuilders\Adhoc;
class Html extends Xml
{
use Adhoc;
const XML_DECLARATION = false;
const DOCTYPE = '<!DOCTYPE html>';
const HTML_MODE = true;
public static function createHtml($lang = null, $manifest = null)
{
return static::createRoot('html')
->attrib('lang', $lang)
->setManifest($manifest);
}
}
$html = Html::createHtml('en');
$body = $html->body();
$article = $body->article();
$article->h1('Scripting languages');
$article->p(Html::abbr('PHP')->setTitle('PHP: Hypertext Preprocessor') . ' is a
server-side scripting language designed for web development but also used
as a general-purpose programming language.');
print $html;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.