From 3bdd211d28a86ccbf1e832d3b871b09f0510faea Mon Sep 17 00:00:00 2001 From: borsodigerii_mac Date: Mon, 16 Oct 2023 17:33:22 +0200 Subject: [PATCH] Edited basic data and structure --- README.md | 20 ++++++++++++++++++-- composer.json | 2 +- src/{Chunker => }/Chunker.php | 0 3 files changed, 19 insertions(+), 3 deletions(-) rename src/{Chunker => }/Chunker.php (100%) diff --git a/README.md b/README.md index 8fd14e6..af52d58 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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); ``` @@ -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); ``` diff --git a/composer.json b/composer.json index 2aee234..d4bc537 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "autoload": { "psr-0": { - "Chunker": "src/" + "Chunker\\": "src/" } }, "autoload-dev": {} diff --git a/src/Chunker/Chunker.php b/src/Chunker.php similarity index 100% rename from src/Chunker/Chunker.php rename to src/Chunker.php