<commit_before># php-little-utils
A curated set of small and util (frequent use) functions. Organizing by "blocks" for test kits.

### XML-JSON convertion
Functions [`xml2json`](http://ppkrauss.github.io/php-little-utils/docs/#method_xml2json), [`xml2dom`](http://ppkrauss.github.io/php-little-utils/docs/#method_xml2dom), [`xpath2jsonML`](http://ppkrauss.github.io/php-little-utils/docs/#method_xpath2jsonML).
See [GUIDE](xml2json.md), [source](src/xml2json.php) and [guide source](test/xml2json_test.php).

Use universal [jsonML](http://json.org/) or specific [SimpleXML](http://php.net/manual/en/book.simplexml.php) conventions, to convert XML to JSON.

### Basic checks

Functions [`is_cli`](http://ppkrauss.github.io/php-little-utils/docs/#method_is_cli), [`isFile`](http://ppkrauss.github.io/php-little-utils/docs/#method_isFile), ...
See [GUIDE](check.md), [source](src/check.php) and [guide source](test/check_test.php).

### Dual getopt
Functions `getopt_std`, ...

Standard PHP's [getopt]() extended to optional (non-terminal accesswebpage.

### Associative array

Functions `file_csv`, `assoc_join`, `assoc_merge`, `assoc_rename`, `assoc_unset`,

### String

Functions `str_getRoot`,  `str_splitByRoot`

------

# Demo guides
*Function guides* are also demonstrators (*demo*). To generate a function guide use `php test/NAME.php > NAME.md`. Example: [xml2json](xml2json.md) was generated by `php test/xml2json.php > xml2json.md`.

# Asserts

To [*assert*](https://en.wikipedia.org/wiki/Assertion_(software_development)) blocks, after install or source changes, use diff with guide sources.<commit_msg>review asserts<commit_after># php-little-utils
A curated set of small and util (frequent use) functions. Organizing by "blocks" for test kits. It is a kind of *"copy/paste function library"*, all functions are standalone.

### XML-JSON convertion
Functions [`xml2json`](http://ppkrauss.github.io/php-little-utils/docs/#method_xml2json), [`xml2dom`](http://ppkrauss.github.io/php-little-utils/docs/#method_xml2dom), [`xpath2jsonML`](http://ppkrauss.github.io/php-little-utils/docs/#method_xpath2jsonML).
See [GUIDE](xml2json.md), [source](src/xml2json.php) and [guide source](test/xml2json_test.php).

Use universal [jsonML](http://json.org/) or specific [SimpleXML](http://php.net/manual/en/book.simplexml.php) conventions, to convert XML to JSON.

### Basic checks

Functions [`is_cli`](http://ppkrauss.github.io/php-little-utils/docs/#method_is_cli), [`isFile`](http://ppkrauss.github.io/php-little-utils/docs/#method_isFile), ...
See [GUIDE](check.md), [source](src/check.php) and [guide source](test/check_test.php).

### Dual getopt
Functions `getopt_std`, ...

Standard PHP's [getopt]() extended to optional (non-terminal accesswebpage.

### Associative array

Functions `file_csv`, `assoc_join`, `assoc_merge`, `assoc_rename`, `assoc_unset`,

### String

Functions `str_getRoot`,  `str_splitByRoot`

------

# Demo guides
*Function guides* are also demonstrators (*demo*). Available:

* [basic check functions](check.md)
* [XML-to-JSON functions](xml2json.md)


NOTE: the `.md` guide files was generated by `php test/NAME.php > NAME.md`. 

# Asserts

To [*assert*](https://en.wikipedia.org/wiki/Assertion_(software_development)) blocks, after local installation or [source](src) changes, use [diff](https://en.wikipedia.org/wiki/Diff_utility) with the `guide.md` sources. Examples:

 * to assert *check* functions: `php test/check_test.php | diff check.md -`
 * to assert *XML-to-JSON* functions: `php test/xml2json_test.php | diff xml2json.md -`

{'fraction_non_alphanumeric': 0.16713404374649468, 'fraction_numerical': 0.007010656197420078, 'mean_word_length': 5.313274336283186, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 23}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4565686', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1196, 'n_words': 263}