2017 © Pedro Peláez
 

library micro-encode

xml encoder and html generator

image

katmore/micro-encode

xml encoder and html generator

  • Tuesday, June 5, 2018
  • by acksponies
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

MicroEncode

xml encoder and html generator, (*1)

Installation

use composer to add MicroEncode to your PHP project:, (*2)

composer require katmore/micro-encode

Usage

XmlEncoder Usage

The XMLEncoder class serializes an XML document from arbitrary data. The PHP data types supported are: boolean, integer, float, string, array, object, and null. The XML document conforms to the Flat XML Schema specification., (*3)

The following is an example of encoding associative array data into an XML document:, (*4)

$myData = [
   'my_example_1'=>'my 1st data value',
   'my_example_2'=>'my 2nd data value',
];

echo (new \MicroEncode\XmlEncoder($myData));

The above code should output the following XML:, (*5)


<fx:data xmlns:fx="https://github.com/katmore/flat/wiki/xmlns" xmlns="https://github.com/katmore/flat/wiki/xmlns-object" fx:md5="37a6259cc0c1dae299a7866489dff0bd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:extxs="https://github.com/katmore/flat/wiki/xmlns-extxs" xsi:type="extxs:Hashmap">
   <my_example_1 xsi:type="xs:string">my 1st data value</my_example_1>
   <my_example_2 xsi:type="xs:string">my 2nd data value</my_example_2>
</fx:data>

HtmlEncoder Usage

The HtmlEncoder class generates HTML from arbitrary data. The PHP data types supported are: boolean, integer, float, string, array, object, and null., (*6)

The following is an example of generating HTML from associative array data:, (*7)

$myData = [
   'my_example_1'=>'my 1st data value',
   'my_example_2'=>'my 2nd data value',
];

echo (new \MicroEncode\HtmlEncoder($myData));

The above code should output the following HTML:, (*8)



  • my_example_1my 1st data value
  • my_example_2my 2nd data value

The above HTML would render into set of unordered list items as follows: * my_example_1: my 1st data value * my_example_2: my 2nd data value, (*9)

Unit Tests

To perform unit tests, execute phpunit located in the vendor/bin directory., (*10)

vendor/bin/phpunit

The tests.sh wrapper script is provided for convenience., (*11)

./tests.sh

MicroEncode - https://github.com/katmore/micro-encode, (*12)

Copyright (c) 2012-2018 Doug Bird. All Rights Reserved., (*13)

License

MicroEncode is copyrighted free software. You may redistribute and modify it under either the terms and conditions of the "The MIT License (MIT)"; or the terms and conditions of the "GPL v3 License". See LICENSE and GPLv3., (*14)

The Versions

05/06 2018

dev-master

9999999-dev https://github.com/katmore/micro-encode

xml encoder and html generator

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

The Development Requires

04/06 2018

v1.0.6

1.0.6.0 https://github.com/katmore/micro-encode

xml encoder and html generator

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

The Development Requires

31/05 2018

v1.0.4

1.0.4.0 https://github.com/katmore/micro-encode

micro package for php containing encoding utility libraries

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

The Development Requires

31/05 2018

v1.0.3

1.0.3.0 https://github.com/katmore/micro-encode

micro package for php containing encoding utility libraries

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

The Development Requires

31/05 2018

v1.0.2

1.0.2.0 https://github.com/katmore/micro-encode

micro package for php containing encoding utility libraries

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

31/05 2018

v1.0.1

1.0.1.0 https://github.com/katmore/micro-encode

micro package for php containing encoding utility libraries

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.2.0

 

01/12 2017

v1.0.0

1.0.0.0 https://github.com/katmore/micro-encode

micro package for php containing encoding utility libraries

  Sources   Download

MIT GPL-3.0+

The Requires

  • php >=7.1.1