2017 © Pedro Peláez
 

library xml

Clacy Builders XML Express is a library for creating XML documents.

image

ml-express/xml

Clacy Builders XML Express is a library for creating XML documents.

  • Friday, May 13, 2016
  • by hoffmann-oss
  • Repository
  • 1 Watchers
  • 2 Stars
  • 272 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

XML Express for PHP

Installation

XML Express for PHP requires PHP 5.4 or newer., (*1)

Add the following to your project's composer.json file:, (*2)

{
    "minimum-stability": "dev",
    "require": {
        "clacy-builders/xml": "dev-master@dev"
    }
}

Run composer install or composer update., (*3)

Without Composer

  1. Download the ZIP file.
  2. Inside your project directory create the directories /vendor/clacy-builders/xml.
  3. From the folder xml-express-php-master inside the ZIP file copy the files it contains into the previously created xml folder.

Replace, (*4)

require_once 'vendor/autoload.php';

with, (*5)

require_once 'vendor/clacy-builders/xml/allIncl.php';

Basic Usage

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;
```

The generated markup:

```xml

<kml xmlns="http://www.opengis.net/kml/2.2">
    <Placemark>
        <name>Cologne Cathedral</name>
        <description>Cologne Cathedral is a Roman Catholic cathedral in Cologne, Germany.</description>
        <Point>
            <coordinates>50.9413,6.958,0</coordinates>
        </Point>
    </Placemark>
</kml>

The Adhoc trait

Adhoc allows you to use any method name not previously defined to add XML elements or attributes., (*6)

<?php
require_once 'vendor/autoload.php';

use \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;

The generated markup:, (*7)

<!DOCTYPE html>
<html lang="en">
    <body>
        <article>
            <h1>Scripting languages</h1>
            <p><abbr title="PHP: Hypertext Preprocessor">PHP</abbr> is a
            server-side scripting language designed for web development but also used
            as a general-purpose programming language.</p>
        </article>
    </body>
</html>

The Versions

13/05 2016

dev-master

9999999-dev

Clacy Builders XML Express is a library for creating XML documents.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

xml writer builder

08/04 2016

0.1

0.1.0.0

XML Express is a library for creating XML documents.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

xml writer builder