PHPackages                             katmore/micro-encode - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. katmore/micro-encode

ActiveLibrary

katmore/micro-encode
====================

xml encoder and html generator

v1.0.6(7y ago)261MITPHPPHP &gt;=7.2.0

Since Dec 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/katmore/micro-encode)[ Packagist](https://packagist.org/packages/katmore/micro-encode)[ Docs](https://github.com/katmore/micro-encode)[ RSS](/packages/katmore-micro-encode/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

MicroEncode
===========

[](#microencode)

xml encoder and html generator

Installation
------------

[](#installation)

use composer to add **MicroEncode** to your PHP project:

```
composer require katmore/micro-encode

```

Usage
-----

[](#usage)

- [Encoding data to XML](#xmlencoder-usage) - XmlEncoder Usage
- [Generating HTML from data](#htmlencoder-usage) - HtmlEncoder Usage

### XmlEncoder Usage

[](#xmlencoder-usage)

The [`XMLEncoder`](./src/MicroEncode/XmlEncoder.php) class serializes an XML document from arbitrary data. The [PHP data types](http://php.net/manual/en/language.types.intro.php) supported are: [`boolean`](http://php.net/manual/en/language.types.boolean.php), [`integer`](http://php.net/manual/en/language.types.integer.php), [`float`](http://php.net/manual/en/language.types.float.php), [`string`](http://php.net/manual/en/language.types.string.php), [`array`](http://php.net/manual/en/language.types.array.php), [`object`](http://php.net/manual/en/language.types.object.php), and [`null`](http://php.net/manual/en/language.types.null.php). The XML document conforms to the [Flat XML Schema](https://github.com/katmore/flat/wiki/xmlns) specification.

The following is an example of encoding associative array data into an XML document:

```
$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:

```

   my 1st data value
   my 2nd data value

```

### HtmlEncoder Usage

[](#htmlencoder-usage)

The [`HtmlEncoder`](./src/MicroEncode/HtmlEncoder.php) class generates HTML from arbitrary data. The [PHP data types](http://php.net/manual/en/language.types.intro.php) supported are: [`boolean`](http://php.net/manual/en/language.types.boolean.php), [`integer`](http://php.net/manual/en/language.types.integer.php), [`float`](http://php.net/manual/en/language.types.float.php), [`string`](http://php.net/manual/en/language.types.string.php), [`array`](http://php.net/manual/en/language.types.array.php), [`object`](http://php.net/manual/en/language.types.object.php), and [`null`](http://php.net/manual/en/language.types.null.php).

The following is an example of generating HTML from associative array data:

```
$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:

```

   my_example_1:&nbsp;my 1st data value
   my_example_2:&nbsp;my 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

Unit Tests
----------

[](#unit-tests)

- [`coverage.txt`](./coverage.txt): unit test coverage report
- [`phpunit.xml`](./phpunit.xml): PHPUnit configuration file
- [`tests/Unit`](./tests/Unit): source code for unit tests

To perform unit tests, execute phpunit located in the `vendor/bin` directory.

```
vendor/bin/phpunit
```

The [`tests.sh`](./tests.sh) wrapper script is provided for convenience.

```
./tests.sh
```

Legal
-----

[](#legal)

### Copyright

[](#copyright)

MicroEncode -

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

### License

[](#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](https://github.com/katmore/micro-encode/blob/master/LICENSE) and [GPLv3](https://github.com/katmore/micro-encode/blob/master/GPLv3).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~37 days

Recently: every ~1 days

Total

6

Last Release

2901d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.1.1

v1.0.1PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef3cde32b1ac961c229cb3e76202b38b5d1a2c571334152c6cee08c43732ce7c?d=identicon)[acksponies](/maintainers/acksponies)

---

Top Contributors

[![ackspony](https://avatars.githubusercontent.com/u/1947018?v=4)](https://github.com/ackspony "ackspony (10 commits)")

---

Tags

encoderencodinghtml-generationhtml-generatorphpphp-libraryphp7phpunit-testsvanilla-phpxml-serialization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/katmore-micro-encode/health.svg)

```
[![Health](https://phpackages.com/badges/katmore-micro-encode/health.svg)](https://phpackages.com/packages/katmore-micro-encode)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
