Skip to content

Commit

Permalink
Added prototype of kosIT Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Apr 8, 2024
1 parent 47730d3 commit 5b25a3d
Show file tree
Hide file tree
Showing 3 changed files with 542 additions and 0 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"setasign/fpdf": "^1",
"setasign/fpdi": "^2",
"symfony/yaml": "^5|^6",
"symfony/process": "^5|^6",
"horstoeko/stringmanagement": "^1",
"horstoeko/mimedb": "^1"
},
Expand Down
25 changes: 25 additions & 0 deletions examples/KositValidator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use horstoeko\zugferd\ZugferdDocumentPdfReader;
use horstoeko\zugferd\ZugferdKositValidator;

require dirname(__FILE__) . "/../vendor/autoload.php";

function showValidationResult($kositValidator)
{
if ($kositValidator->validationFailed()) {
echo "\033[01;31mValidation failed\e[0m\n";
foreach ($kositValidator->validationErrors() as $validationError) {
echo $validationError . PHP_EOL;
}
} else {
echo "\033[01;32mValidation passed\e[0m\n";
}
}

$document = ZugferdDocumentPdfReader::readAndGuessFromFile(dirname(__FILE__) . "/invoice_1.pdf");

$kositValidator = new ZugferdKositValidator($document);
$kositValidator->validate();

showValidationResult($kositValidator);
Loading

0 comments on commit 5b25a3d

Please sign in to comment.