PHPackages                             horstoeko/mimedb - 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. horstoeko/mimedb

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

horstoeko/mimedb
================

Get mimetypes by fileextensions and visa versa

v1.0.8(1y ago)44.1M↓11.8%13MITPHPPHP &gt;=7.3CI passing

Since Sep 22Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/horstoeko/mimedb)[ Packagist](https://packagist.org/packages/horstoeko/mimedb)[ Docs](https://github.com/horstoeko/mimedb)[ RSS](/packages/horstoeko-mimedb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (7)Versions (11)Used By (3)

MimeDB
======

[](#mimedb)

[![Latest Stable Version](https://camo.githubusercontent.com/0b34c389baf7cc96b544933b60bbae54c9c7c9d39978314a4cc9abae8ba29031/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f686f7273746f656b6f2f6d696d6564622e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/mimedb)[![PHP version](https://camo.githubusercontent.com/9feb8881d82c65220b07f4ea8e51083397b3a2d775659bdf08aca4f1e07e3d1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f686f7273746f656b6f2f6d696d6564622e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/mimedb)[![License](https://camo.githubusercontent.com/b5b46d9875a3ab0efae27123f0e355a8f278f575eaa2c5ecc98ac9aacc0731c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f7273746f656b6f2f6d696d6564622e7376673f7374796c653d706c6173746963)](https://packagist.org/packages/horstoeko/mimedb)

[![Build Status](https://github.com/horstoeko/mimedb/actions/workflows/build.ci.yml/badge.svg)](https://github.com/horstoeko/mimedb/actions/workflows/build.ci.yml)[![Release Status](https://github.com/horstoeko/mimedb/actions/workflows/build.release.yml/badge.svg)](https://github.com/horstoeko/mimedb/actions/workflows/build.release.yml)

Table of Contents
-----------------

[](#table-of-contents)

- [MimeDB](#mimedb)
    - [Table of Contents](#table-of-contents)
    - [License](#license)
    - [Overview](#overview)
    - [Dependencies](#dependencies)
    - [Installation](#installation)
    - [Usage](#usage)
        - [Get all MimeTypes by file extensions](#get-all-mimetypes-by-file-extensions)
        - [Get all file extensions by MimeType](#get-all-file-extensions-by-mimetype)

License
-------

[](#license)

The code in this project is provided under the [MIT](https://opensource.org/licenses/MIT) license.

Overview
--------

[](#overview)

With `horstoeko/mimedb` you can receive mimetypes by file extension and visa versa.

Dependencies
------------

[](#dependencies)

This package has no dependencies.

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

[](#installation)

There is one recommended way to install `horstoeko/mimedb` via [Composer](https://getcomposer.org/):

- adding the dependency to your `composer.json` file:

```
  "require": {
      ..
      "horstoeko/mimedb":"^1",
      ..
  },
```

Usage
-----

[](#usage)

For detailed eplanation you may have a look in the [examples](https://github.com/horstoeko/mimedb/tree/master/examples) of this package and the documentation attached to every release.

### Get all MimeTypes by file extensions

[](#get-all-mimetypes-by-file-extensions)

```
use horstoeko\mimedb\MimeDb;

require dirname(__FILE__) . "/../vendor/autoload.php";

$mimeDb = MimeDb::singleton();

// OUTPUT:
//   application/vnd.openxmlformats-officedocument.wordprocessingml.document

echo $mimeDb->findFirstMimeTypeByExtension('.docx') . PHP_EOL;

// OUTPUT:
//   application/vnd.openxmlformats-officedocument.wordprocessingml.document

foreach ($mimeDb->findAllMimeTypesByExtension('.docx') as $mimetype) {
    echo $mimetype . PHP_EOL;
}
```

### Get all file extensions by MimeType

[](#get-all-file-extensions-by-mimetype)

```
use horstoeko\mimedb\MimeDb;

error_reporting(E_ERROR | E_WARNING | E_PARSE);

$mimeDb = MimeDb::singleton();

// OUTPUT:
//   docx

echo $mimeDb->findFirstFileExtensionByMimeType('application/vnd.openxmlformats-officedocument.wordprocessingml.document') . PHP_EOL;

// OUTPUT:
//   mkv
//   mk3d
//   mks

foreach ($mimeDb->findAllFileExtensionsByMimeType('video/x-matroska') as $fileExtension) {
    echo $fileExtension . PHP_EOL;
}

// OUTPUT:
//   docx

foreach ($mimeDb->findAllFileExtensionsByMimeType('application/vnd.openxmlformats-officedocument.wordprocessingml.document') as $fileExtension) {
    echo $fileExtension . PHP_EOL;
}
```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance65

Regular maintenance activity

Popularity48

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.3% 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

Every ~55 days

Recently: every ~109 days

Total

9

Last Release

532d ago

PHP version history (2 changes)v1.0.0PHP ^7.3|^7.4|^8.0|^8.1|^8.2|^8.3

v1.0.7PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/24de09032b9a378d782bb7eac3f60914f64967e5a68d51527439dcf7c51711ba?d=identicon)[horstoeko](/maintainers/horstoeko)

---

Top Contributors

[![horstoeko](https://avatars.githubusercontent.com/u/2326713?v=4)](https://github.com/horstoeko "horstoeko (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

fileextensionmime-databasemimetypephpphp7php8mimetypefile extension

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/horstoeko-mimedb/health.svg)

```
[![Health](https://phpackages.com/badges/horstoeko-mimedb/health.svg)](https://phpackages.com/packages/horstoeko-mimedb)
```

###  Alternatives

[wapmorgan/file-type-detector

Detects file type by filename or content and generates correct mimetype.

35367.8k2](/packages/wapmorgan-file-type-detector)[dfridrich/php-mime-type

Simple PHP class for guessing file mime type based on file extension with ability to use in Symfony project.

17274.8k3](/packages/dfridrich-php-mime-type)

PHPackages © 2026

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