PHPackages                             katzien/php-mime-type - 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. katzien/php-mime-type

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

katzien/php-mime-type
=====================

A PHP library to detect the mime type of files.

2.1.0(9y ago)1271.8k—3.6%42MITPHPPHP &gt;=5.6

Since Mar 19Pushed 9y ago2 watchersCompare

[ Source](https://github.com/katzien/PhpMimeType)[ Packagist](https://packagist.org/packages/katzien/php-mime-type)[ Docs](https://github.com/katzien/PhpMimeType)[ RSS](/packages/katzien-php-mime-type/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (9)Used By (2)

PhpMimeType
===========

[](#phpmimetype)

A PHP library to detect the mime type of a file.

[![Build Status](https://camo.githubusercontent.com/0be505d3bf1098f528fa58a7aab06cba07946676c9d3d168a16b480b7745ae5a/68747470733a2f2f7472617669732d63692e6f72672f6b61747a69656e2f5068704d696d65547970652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/katzien/PhpMimeType)[![Coverage Status](https://camo.githubusercontent.com/ccd0db4609af646e4840ad6c568a7ed5b561400b2390ef06a9a2ec86b4ea778c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6b61747a69656e2f5068704d696d65547970652f62616467652e737667)](https://coveralls.io/r/katzien/PhpMimeType)

[![Latest Stable Version](https://camo.githubusercontent.com/f7b1e22fb136ea9776a9fbc3f206bb5dfb800bf298a1d26e7c93cbec5a15dbca/68747470733a2f2f706f7365722e707567782e6f72672f6b61747a69656e2f7068702d6d696d652d747970652f762f737461626c652e737667)](https://packagist.org/packages/katzien/php-mime-type)[![Total Downloads](https://camo.githubusercontent.com/8eb80256633c655ac8ca4ea13785e645d7577efea0d72f5b162226befb19fcc8/68747470733a2f2f706f7365722e707567782e6f72672f6b61747a69656e2f7068702d6d696d652d747970652f646f776e6c6f6164732e737667)](https://packagist.org/packages/katzien/php-mime-type)

[![License](https://camo.githubusercontent.com/815b60edb19ba3b1d907711950e97304ac9a16d2cb738b1791cf311665682ce8/68747470733a2f2f706f7365722e707567782e6f72672f6b61747a69656e2f7068702d6d696d652d747970652f6c6963656e73652e737667)](https://packagist.org/packages/katzien/php-mime-type)

Not invented here
-----------------

[](#not-invented-here)

This is a modernised version of [Jason Sheets's mimetype class](http://www.phpclasses.org/browse/file/2743.html).

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

[](#installation)

To add the PhpMimeType library to your project run

```
composer require katzien/php-mime-type
```

from the directory where your composer.json file is.

See [Packagist](https://packagist.org/packages/katzien/php-mime-type) for more details.

Version Guidance
----------------

[](#version-guidance)

VersionStatusPHP version required1.xMaintainedmin. 5.32.xLatest (recommended)min. 5.6If you're using PHP 5.6 or higher, you should use the latest 2.x version. There is no difference in usage between 1.x and 2.x, so the upgrade should not require any code changes.

Differences between 1.x and 2.x:

- syntax
- versions of composer dependencies

Usage
-----

[](#usage)

```
$type = \MimeType\MimeType::getType('my-file.pdf'); // returns "application/pdf"
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

Every ~105 days

Recently: every ~27 days

Total

8

Last Release

3344d ago

Major Versions

1.1.0 → 2.0.12015-12-16

1.2.0 → 2.1.02017-03-23

PHP version history (3 changes)1.1.0PHP &gt;=5.3.0

2.0.1PHP &gt;=5.6.0

2.0.2PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec0451a62a177a203414f674ddc5dc8414478861349393f35a3e87f9207f91ca?d=identicon)[katzien](/maintainers/katzien)

---

Top Contributors

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

---

Tags

phpmimetype

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/katzien-php-mime-type/health.svg)

```
[![Health](https://phpackages.com/badges/katzien-php-mime-type/health.svg)](https://phpackages.com/packages/katzien-php-mime-type)
```

###  Alternatives

[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)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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