PHPackages                             tinram/file-identifier - 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. tinram/file-identifier

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

tinram/file-identifier
======================

A simple library to identify files through MIME types and file signatures.

93164[1 issues](https://github.com/Tinram/File-Identifier/issues)PHP

Since Apr 19Pushed 6y ago2 watchersCompare

[ Source](https://github.com/Tinram/File-Identifier)[ Packagist](https://packagist.org/packages/tinram/file-identifier)[ RSS](/packages/tinram-file-identifier/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

File Identifier
===============

[](#file-identifier)

#### Identify a file through MIME type and file signature detection.

[](#identify-a-file-through-mime-type-and-file-signature-detection)

Purpose
-------

[](#purpose)

Detect a file's type through MIME type information and file signature (header) bytes.

(File extensions are ignored.)

Uses
----

[](#uses)

\*nix systems have the `file` command, which is a powerful file identifier, and callable from PHP's shell functions.

Nevertheless, this command is not always available.

The main uses of **File Identifier** are:

- For \*nix servers where PHP shell functions are disabled in *php.ini* ( `disable_functions=` )
- PHP running on Windows, where no `file` command natively exists
- When older versions of `file` (e.g. v. 5.09) are installed on the \*nix server, and which do not recognise some files such as *.gpg*
- Where custom, old, or rare file types cannot be identified by the `file` command.

Example Usage
-------------

[](#example-usage)

```
    require('FileIdentifier.php');
    require('FileSignatures.php');

    use Tinram\FileIdentifier\FileIdentifier;

    $f = new FileIdentifier('mira.png');
    $r = $f->getResult();
    echo $r['mimeinfo'] . PHP_EOL . $r['fileinfo'];
```

File Signatures
---------------

[](#file-signatures)

The file signature data (*FileSignatures.php*) contain a limited range of common file type signatures in hexadecimal bytes.

This data array can be easily extended with additional and custom file signatures.

License
-------

[](#license)

File Identifier is released under the [GPL v.3](https://www.gnu.org/licenses/gpl-3.0.html).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/12d2544a8156c9573ed64f06393c9b2524b4cfc092ebee30ce07f224536dc94c?d=identicon)[Tinram](/maintainers/Tinram)

---

Top Contributors

[![Tinram](https://avatars.githubusercontent.com/u/1908972?v=4)](https://github.com/Tinram "Tinram (32 commits)")

---

Tags

file-headerfile-identificationfile-signaturefilesmagic-bytessignature-detectionsignatures

### Embed Badge

![Health badge](/badges/tinram-file-identifier/health.svg)

```
[![Health](https://phpackages.com/badges/tinram-file-identifier/health.svg)](https://phpackages.com/packages/tinram-file-identifier)
```

PHPackages © 2026

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