最新服务器上的版本,以后用这个
wangzhenxin
2023-11-19 bc164b8bdbfbdf1d8229a5ced6b08d7cb8db7361
commit | author | age
2207d6 1 # Tokenizer
W 2
3 A small library for converting tokenized PHP source code into XML.
4
5 [![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)
6 [![Code Coverage](https://scrutinizer-ci.com/g/theseer/tokenizer/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/theseer/tokenizer/?branch=master)
7 [![Build Status](https://scrutinizer-ci.com/g/theseer/tokenizer/badges/build.png?b=master)](https://scrutinizer-ci.com/g/theseer/tokenizer/build-status/master)
8
9 ## Installation
10
11 You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):
12
13     composer require theseer/tokenizer
14
15 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:
16
17     composer require --dev theseer/tokenizer
18
19 ## Usage examples
20
21 ```php
22 $tokenizer = new TheSeer\Tokenizer\Tokenizer();
23 $tokens = $tokenizer->parse(file_get_contents(__DIR__ . '/src/XMLSerializer.php'));
24
25 $serializer = new TheSeer\Tokenizer\XMLSerializer();
26 $xml = $serializer->toXML($tokens);
27
28 echo $xml;
29 ```
30
31 The generated XML structure looks something like this:
32
33 ```xml
34 <?xml version="1.0"?>
35 <source xmlns="https://github.com/theseer/tokenizer">
36  <line no="1">
37   <token name="T_OPEN_TAG">&lt;?php </token>
38   <token name="T_DECLARE">declare</token>
39   <token name="T_OPEN_BRACKET">(</token>
40   <token name="T_STRING">strict_types</token>
41   <token name="T_WHITESPACE"> </token>
42   <token name="T_EQUAL">=</token>
43   <token name="T_WHITESPACE"> </token>
44   <token name="T_LNUMBER">1</token>
45   <token name="T_CLOSE_BRACKET">)</token>
46   <token name="T_SEMICOLON">;</token>
47  </line>
48 </source>
49 ```