PHPackages                             kraenzle-ritter/puidentify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. kraenzle-ritter/puidentify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kraenzle-ritter/puidentify
==========================

Unified PHP interface for PRONOM-based file identification using Siegfried and FIDO.

v1.0.0(8mo ago)032MITPHPPHP &gt;=8.1CI passing

Since Oct 30Pushed 8mo agoCompare

[ Source](https://github.com/kraenzle-ritter/puidentify)[ Packagist](https://packagist.org/packages/kraenzle-ritter/puidentify)[ Docs](https://github.com/kraenzle-ritter/puidentify)[ RSS](/packages/kraenzle-ritter-puidentify/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Puidentify
==========

[](#puidentify)

[![CI](https://github.com/kraenzle-ritter/puidentify/workflows/CI/badge.svg)](https://github.com/kraenzle-ritter/puidentify/actions)[![Code Quality](https://github.com/kraenzle-ritter/puidentify/workflows/Code%20Quality/badge.svg)](https://github.com/kraenzle-ritter/puidentify/actions)[![PHP Version](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://www.php.net/)[![License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

**Puidentify** is a PHP library for file format identification using PRONOM PUIDs. It supports **Siegfried**, **FIDO**, or both engines with priority/fallback mechanisms.

Installation
------------

[](#installation)

```
composer require kraenzle-ritter/puidentify
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- At least one of the following tools installed:
    - [Siegfried](https://github.com/richardlehane/siegfried) (`sf` command)
    - [FIDO](https://github.com/openpreserve/fido) (`fido` command)

Quick Start
-----------

[](#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
--------------

[](#advanced-usage)

### Custom Binary Paths

[](#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

[](#check-available-engines)

```
$availableEngines = $identifier->getAvailableEngines();
echo "Available engines: " . count($availableEngines);
```

### Result Methods

[](#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
--------------

[](#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
-------

[](#testing)

```
# Install dependencies
composer install

# Run tests
composer test

# Run static analysis
composer analyse
```

License
-------

[](#license)

MIT License

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance61

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

246d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/76f31e7e6772db47a91388ed82840fae1fa57185bb82a64924bb3839697222c2?d=identicon)[ottosmops](/maintainers/ottosmops)

---

Top Contributors

[![ottosmops](https://avatars.githubusercontent.com/u/4144389?v=4)](https://github.com/ottosmops "ottosmops (3 commits)")

---

Tags

fidofile-identificationdigital-preservationpronomsiegfriedformat-identification

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kraenzle-ritter-puidentify/health.svg)

```
[![Health](https://phpackages.com/badges/kraenzle-ritter-puidentify/health.svg)](https://phpackages.com/packages/kraenzle-ritter-puidentify)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
