Chris@14: # Tokenizer Chris@14: Chris@14: A small library for converting tokenized PHP source code into XML. Chris@14: Chris@14: [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/theseer/tokenizer/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/theseer/tokenizer/?branch=master) Chris@14: [![Code Coverage](https://scrutinizer-ci.com/g/theseer/tokenizer/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/theseer/tokenizer/?branch=master) Chris@14: [![Build Status](https://scrutinizer-ci.com/g/theseer/tokenizer/badges/build.png?b=master)](https://scrutinizer-ci.com/g/theseer/tokenizer/build-status/master) Chris@14: Chris@14: ## Installation Chris@14: Chris@14: You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/): Chris@14: Chris@14: composer require theseer/tokenizer Chris@14: Chris@14: 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: Chris@14: Chris@14: composer require --dev theseer/tokenizer Chris@14: Chris@14: ## Usage examples Chris@14: Chris@14: ```php Chris@14: $tokenizer = new TheSeer\Tokenizer\Tokenizer(); Chris@14: $tokens = $tokenizer->parse(file_get_contents(__DIR__ . '/src/XMLSerializer.php')); Chris@14: Chris@14: $serializer = new TheSeer\Tokenizer\XMLSerializer(); Chris@14: $xml = $serializer->toXML($tokens); Chris@14: Chris@14: echo $xml; Chris@14: ``` Chris@14: Chris@14: The generated XML structure looks something like this: Chris@14: Chris@14: ```xml Chris@14: Chris@14: Chris@14: Chris@14: <?php Chris@14: declare Chris@14: ( Chris@14: strict_types Chris@14: Chris@14: = Chris@14: Chris@14: 1 Chris@14: ) Chris@14: ; Chris@14: Chris@14: Chris@14: ```