PHP code example of kraenzle-ritter / preservation-strategy

1. Go to this page and download the library: Download kraenzle-ritter/preservation-strategy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kraenzle-ritter / preservation-strategy example snippets


use KraenzleRitter\PreservationStrategy\Validator;

$result = (new Validator())->validate($json);   // string | array | stdClass

$result->valid;        // false as soon as one finding is an error
$result->errors;       // list<ValidationError>: path, keyword, message, warning
$result->warnings();   // the findings that leave it valid

use KraenzleRitter\PreservationStrategy\ArrayFormatPolicyRules;

$catalogue = new ArrayFormatPolicyRules([
    'pdfx_pdfa2b' => ['target' => ['fmt/477']],
    'tiff_zip' => [],
]);
$result = (new Validator($catalogue))->validate($json);

use KraenzleRitter\PreservationStrategy\ParExport;

$rules = (new ParExport())->businessRules($json);   // list of PAR Business Rules (v1.2.0)