@@ -6,6 +6,22 @@ The algorithm was written using the XMLParser php library, which is capable of p
6
6
7
7
With the correct charset specified, it can handle special characters, and also parse them for validation.
8
8
9
+ ## Installing
10
+ You can use this library by downloading the ` src\Chunker.php ` file, and using it directly, or by ** using composer** as your package manager:
11
+ ``` bash
12
+ $ composer require borsodigerii/php-xml-chunker
13
+ ```
14
+
15
+ Alternatively, you can add this library as a dependency in your ` composer.json ` file:
16
+ ``` json
17
+ "require" : {
18
+ "borsodigerii/php-xml-chunker" : " 2.0.0"
19
+ }
20
+ ```
21
+ Then you just have to run ` composer update ` .
22
+
23
+ The minimum PHP version for this library to work, is ** >= 7.4.0**
24
+
9
25
## Usage
10
26
### Simple Chunking
11
27
The implementation is Object-oriented, so in order to split the files, an instance of Chunker has to be created first.
@@ -20,7 +36,7 @@ $validationFunction = fn($data, $tag) => {
20
36
}
21
37
$checkingTags = array();
22
38
23
- $chunker = new Chunker($xmlfile, $chunkSize, $outputFilePrefix, $validationFunction, $checkingTags);
39
+ $chunker = new Chunker\Chunker ($xmlfile, $chunkSize, $outputFilePrefix, $validationFunction, $checkingTags);
24
40
```
25
41
26
42
@@ -88,7 +104,7 @@ function validation($data, $tag) {
88
104
$mainTag = "shopItem";
89
105
$rootTag = "Shop";
90
106
91
- $chunker = new Chunker($xmlfile, $chunkSize, $outPrefix, "validation", $chekingTags);
107
+ $chunker = new Chunker\Chunker ($xmlfile, $chunkSize, $outPrefix, "validation", $chekingTags);
92
108
$chunker.chunkXML($mainTag, $rootTag);
93
109
```
94
110
0 commit comments