Skip to content

Commit

Permalink
Edited basic data and structure
Browse files Browse the repository at this point in the history
  • Loading branch information
borsodigerii committed Oct 16, 2023
1 parent 18b4f05 commit 3bdd211
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ The algorithm was written using the XMLParser php library, which is capable of p

With the correct charset specified, it can handle special characters, and also parse them for validation.

## Installing
You can use this library by downloading the `src\Chunker.php` file, and using it directly, or by **using composer** as your package manager:
```bash
$ composer require borsodigerii/php-xml-chunker
```

Alternatively, you can add this library as a dependency in your `composer.json` file:
```json
"require": {
"borsodigerii/php-xml-chunker": "2.0.0"
}
```
Then you just have to run `composer update`.

The minimum PHP version for this library to work, is **>= 7.4.0**

## Usage
### Simple Chunking
The implementation is Object-oriented, so in order to split the files, an instance of Chunker has to be created first.
Expand All @@ -20,7 +36,7 @@ $validationFunction = fn($data, $tag) => {
}
$checkingTags = array();

$chunker = new Chunker($xmlfile, $chunkSize, $outputFilePrefix, $validationFunction, $checkingTags);
$chunker = new Chunker\Chunker($xmlfile, $chunkSize, $outputFilePrefix, $validationFunction, $checkingTags);
```


Expand Down Expand Up @@ -88,7 +104,7 @@ function validation($data, $tag) {
$mainTag = "shopItem";
$rootTag = "Shop";

$chunker = new Chunker($xmlfile, $chunkSize, $outPrefix, "validation", $chekingTags);
$chunker = new Chunker\Chunker($xmlfile, $chunkSize, $outPrefix, "validation", $chekingTags);
$chunker.chunkXML($mainTag, $rootTag);
```

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"autoload": {
"psr-0": {
"Chunker": "src/"
"Chunker\\": "src/"
}
},
"autoload-dev": {}
Expand Down
File renamed without changes.

0 comments on commit 3bdd211

Please sign in to comment.