2017 © Pedro Peláez
 

library xml

lib16 XML Builder is a PHP 7 library for creating XML documents.

image

lib16/xml

lib16 XML Builder is a PHP 7 library for creating XML documents.

  • Monday, June 5, 2017
  • by hoffmann-oss
  • Repository
  • 1 Watchers
  • 3 Stars
  • 412 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

XML Builder for PHP 7

A library for creating XML documents written in PHP 7., (*1)

Build Status Coverage, (*2)

Installation with Composer

This package is available on packagist, so you can use Composer to install it: composer require lib16/xml, (*3)

Basic Usage

append('Placemark');
        $pm->append('name', $name);
        $pm->append('description', $description);
        $pm->append('Point')->append(
            'coordinates',
            implode(',', array_filter([
                $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</coordinates>
        </Point>
    </Placemark>
</kml>

The Adhoc trait

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

';
    const HTML_MODE_ENABLED = true;

    public static function createHtml(
        string $lang = null,
        string $manifest = null
    ): self {
        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:

```html

<!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

05/06 2017

dev-master

9999999-dev https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

18/03 2017

v1.2

1.2.0.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

05/02 2017

v1.1.4

1.1.4.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

29/01 2017

v1.1.3

1.1.3.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

28/01 2017

v1.1.2

1.1.2.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

26/01 2017

v1.1.1

1.1.1.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

09/01 2017

v1.1

1.1.0.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder

07/01 2017

v1.0

1.0.0.0 https://github.com/lib16/xml-builder-php

lib16 XML Builder is a PHP 7 library for creating XML documents.

  Sources   Download

MIT

The Requires

 

xml writer builder