PHP code example of kraenzle-ritter / format-policy

1. Go to this page and download the library: Download kraenzle-ritter/format-policy 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 / format-policy example snippets


use KraenzleRitter\FormatPolicy\Preingest;

$result = app(Preingest::class)->run($path, 'upload', [
    'skip_rules' => ['tiff_zip'],                               // optional rules the user deselected
    'delivered' => ['algorithm' => 'sha256', 'value' => '…'],   // checksum that came with the file
]);

$result->path;          // the file to ingest: the delivered one or a result
$result->outcomes;      // list<RuleOutcome>: rule, status (ok|failed|info), details
$result->cleanup();     // after ingesting: removes the working directory

$preingest = app(Preingest::class)->withSwitches(new ArraySwitchStore(['tiff_zip' => true]));