kraenzle-ritter / nara-risk
Laravel package for automated digital preservation risk assessment based on NARA Digital Preservation Framework TTL/RDF data
Requires
- php: ^8.2
- illuminate/support: ^11.44|^12.4|^13.0
- pietercolpaert/hardf: ^0.5|^0.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- larastan/larastan: ^2.9|^3.7
- laravel/boost: ^1.6|^2.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- phpstan/phpstan: ^1.12|^2.0
- phpunit/phpunit: ^10.0|^11.0|^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A Laravel package for automated digital preservation risk assessment based on the NARA Digital Preservation Framework.
Features
- Official NARA TTL/RDF data integration
- Automatic caching with 28-day refresh cycle
- Nara Risk assessment for 100+ file formats via PRONOM IDs
- Nara Preservation action recommendations
- Support for 16 NARA format categories
- Nara Tool suggestions for preservation workflows
Installation
composer require kraenzle-ritter/nara-risk
The package auto-registers via Laravel's package discovery.
Usage
use KraenzleRitter\NaraRisk\Services\NaraAssessmentService; $service = app(NaraAssessmentService::class); $result = $service->assessFile('fmt/276'); // PDF 1.7 echo $result['risk_level']; // "Low" echo $result['category']; // "Presentation and Publishing" echo $result['recommended_action']; // "Retain"
Response Structure
Each assessment returns an array with these key fields:
pronom_id- PRONOM identifierformat_name- Human-readable format namecategory- NARA format categoryrisk_level- Low, Moderate, or Highrecommended_action- Retain, Transform, Assess, or Identifytools- Array of suggested preservation toolsnara_compliant- Boolean indicating NARA framework coverageassessment_notes- Detailed recommendations
Additional Methods
// Get all supported PRONOM IDs $ids = $service->getSupportedPronomIds(); // Get format statistics $stats = $service->getFormatStatistics(); // Check cache status $cacheInfo = $service->getCacheInfo();
Configuration
Publish the configuration with php artisan vendor:publish --tag=nara-config, or set the
environment variable. The defaults:
| Key | Default | |
|---|---|---|
cache_directory |
storage/app/nara |
TTL files and the parsed format table |
cache_days |
28 |
age after which fileformats.ttl is downloaded again |
download |
true (NARA_DOWNLOAD) |
false on servers without internet access: the file in the cache directory is used however old, and nothing waits for a download |
timeout |
60 |
seconds per download |
retry_after_minutes |
360 |
a failed download is not retried before; meanwhile the old file is used, or the assessment fails at once if there is none |
schema_urls |
archives.gov | fileformats is read by the assessment; nara:download-schema fetches all |
The parsed table is stored next to the TTL file (nara_fileformats.ttl.parsed) and reused
while the file is unchanged, so a queue job assessing a single file does not parse 1 MB of
Turtle each time.
Testing
Run the test suite:
composer test
Some tests download from archives.gov; NaraTtlCacheTest runs without network.
Requirements
- PHP 8.2+
- Laravel 11.44+ | 12.4+ | 13
Data Sources
This package uses official data from:
Data is cached locally and refreshed automatically every 28 days.
License
This project is licensed under the MIT License.