kraenzle-ritter/puidentify
Composer 安装命令:
composer require kraenzle-ritter/puidentify
包简介
Unified PHP interface for PRONOM-based file identification using Siegfried and FIDO.
README 文档
README
Puidentify is a PHP library for file format identification using PRONOM PUIDs. It supports Siegfried, FIDO, or both engines with priority/fallback mechanisms.
Installation
composer require kraenzle-ritter/puidentify
Requirements
- PHP 8.1 or higher
- At least one of the following tools installed:
Quick Start
use Puidentify\Identifier; use Puidentify\Engine\FidoEngine; use Puidentify\Engine\SiegfriedEngine; // Create identifier with engines (priority order) $identifier = new Identifier([ new SiegfriedEngine(), // Primary new FidoEngine() // Fallback ]); // Identify a file $result = $identifier->identify('/path/to/file.pdf'); if ($result) { echo $result; // "PUID: fmt/276 (PDF/A-1b) via Siegfried" // Access individual properties echo "PUID: " . $result->puid; echo "Format: " . $result->formatName; echo "Engine: " . $result->engine; }
Advanced Usage
Custom Binary Paths
use Puidentify\Engine\SiegfriedEngine; use Puidentify\Engine\FidoEngine; $identifier = new Identifier([ new SiegfriedEngine('/usr/local/bin/sf'), new FidoEngine('/opt/fido/bin/fido') ]);
Check Available Engines
$availableEngines = $identifier->getAvailableEngines(); echo "Available engines: " . count($availableEngines);
Result Methods
$result = $identifier->identify('/path/to/file.pdf'); // Access basic properties echo "PUID: " . $result->puid; echo "Format: " . $result->formatName; echo "Engine: " . $result->engine; // Access extended properties (if available) if ($result->hasMimeType()) { echo "MIME: " . $result->mimeType; } if ($result->hasVersion()) { echo "Version: " . $result->version; } if ($result->hasConfidence()) { echo "Confidence: " . ($result->confidence * 100) . "%"; } // Convert to array with all properties $array = $result->toArray(); // [ // 'puid' => 'fmt/276', // 'formatName' => 'PDF/A-1b', // 'engine' => 'Siegfried', // 'mimeType' => 'application/pdf', // 'fileExtension' => 'pdf', // 'version' => '1.4', // 'confidence' => 0.95, // 'rawOutput' => [...] // Full engine output // ] // Enhanced string representation echo $result; // "PUID: fmt/276 (PDF/A-1b) v1.4 [95%] via Siegfried"
Error Handling
The library throws specific exceptions for different error conditions:
use Puidentify\Exception\FileNotFoundException; use Puidentify\Exception\EngineException; try { $result = $identifier->identify('/path/to/file.pdf'); } catch (FileNotFoundException $e) { echo "File not found or not readable: " . $e->getMessage(); } catch (EngineException $e) { echo "Engine error: " . $e->getMessage(); }
Testing
# Install dependencies composer install # Run tests composer test # Run static analysis composer analyse
License
MIT License
kraenzle-ritter/puidentify 适用场景与选型建议
kraenzle-ritter/puidentify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 32 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「fido」 「file-identification」 「digital-preservation」 「pronom」 「siegfried」 「format-identification」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kraenzle-ritter/puidentify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kraenzle-ritter/puidentify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kraenzle-ritter/puidentify 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
FIDO2/Webauthn Conformance Toolset
Support passkeys and Web Authentication
A simple library to identify files through MIME types and file signatures.
Fork of web-auth/webauthn-lib that supports Android FIDO2/Passkey attestations
Filament webauthn sign in and registration
Canonical JSON Schema (Draft 2020-12) and framework-free Validator for Anton's metadata.json import format.
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-30