2017 © Pedro Peláez
 

library prettyxml

small xml prettyfier that uses no libs

image

kasparsu/prettyxml

small xml prettyfier that uses no libs

  • Saturday, March 10, 2018
  • by kasparsu
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

kasparsu/prettyxml

Xml prettifier that uses no libs or packages., (*1)

DISCLAIMER: This is in development and if you have any sense or reason you will not use this package!

Installation

You can add this library as a local, per-project dependency to your project using Composer:, (*2)

composer require kasparsu/prettyxml

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:, (*3)

composer require --dev kasparsu/prettyxml

Usage

Prettyfing Xml

The Prettyfier class can be used to generate a formated representation of the raw XML input:, (*4)

<?php
$pretty = new \Kasparsu\PrettyXml\Prettyfier('<apply><csymbol encoding="OpenMath"><msub><mi>P</mi><mn>1</mn></msub></csymbol><ci>x</ci></apply>', "\t");
print $pretty->prettify();

The code above yields the output below:, (*5)

<apply>
       <csymbol encoding="OpenMath">
           <msub>
               <mi>P</mi>
               <mn>1</mn>
           </msub>
       </csymbol>
       <ci>x</ci>
</apply>

Development

You can run docker enviroment using, (*6)

docker-compose up -d

to run tests use, (*7)

docker-compose exec app vendor/bin/phpunit

to run examples, (*8)

docker-compose exec app php example/example.php

docker-compose exec app php example/example3mb.php

docker-compose exec app php example/example200kb.php

To Do

  • cover all functionality with tests
  • cover more edge cases with code
  • use simpleXml instead of this

The Versions

10/03 2018

dev-master

9999999-dev

small xml prettyfier that uses no libs

  Sources   Download

WTFPL

The Requires

  • php >=7.0.0

 

The Development Requires

xml beautifier prettyfier nolibs