PHPackages                             hoa/mime - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. hoa/mime

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

hoa/mime
========

The Hoa\\Mime library.

3.17.01.10(9y ago)98312.8k↑149.1%15[1 issues](https://github.com/hoaproject/Mime/issues)[3 PRs](https://github.com/hoaproject/Mime/pulls)8BSD-3-ClausePHP

Since Sep 16Pushed 5y ago8 watchersCompare

[ Source](https://github.com/hoaproject/Mime)[ Packagist](https://packagist.org/packages/hoa/mime)[ Docs](https://hoa-project.net/)[ RSS](/packages/hoa-mime/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (7)Versions (17)Used By (8)

 [![Hoa](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)](https://camo.githubusercontent.com/2b5c32c5d4bc5e9298821b22d364a522e2dbc0295c1c011b1f9f86a4d07df07e/68747470733a2f2f7374617469632e686f612d70726f6a6563742e6e65742f496d6167652f486f612e737667)

---

 [![Build status](https://camo.githubusercontent.com/7e8c643bcf85fea2e2c0b6ef0297fd5b1db8771f96302e90aef61543ec66702a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f686f6170726f6a6563742f4d696d652f6d61737465722e737667)](https://travis-ci.org/hoaproject/Mime) [![Code coverage](https://camo.githubusercontent.com/d8d54c9386236699a45e1ba2f709b147e31ed0a49e008e3291f36ef4f7187cd9/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f686f6170726f6a6563742f4d696d652f6d61737465722e737667)](https://coveralls.io/github/hoaproject/Mime?branch=master) [![Packagist](https://camo.githubusercontent.com/c33ef77ed2fed8afb7aa8e1c0618bed38dbba847e686e8c56f898709eb5d3378/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686f612f6d696d652e737667)](https://packagist.org/packages/hoa/mime) [![License](https://camo.githubusercontent.com/f05006606ce559ac3b9a119e20992dcc2ccfdb3d502acfc836fad2c446fb8e22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f686f612f6d696d652e737667)](https://hoa-project.net/LICENSE)

 Hoa is a **modular**, **extensible** and **structured** set of PHP libraries.
 Moreover, Hoa aims at being a bridge between industrial and research worlds.

Hoa\\Mime
=========

[](#hoamime)

[![Help on IRC](https://camo.githubusercontent.com/4dbc9c9d28c30cf1ab591f4bb8212fe4dbddc734145df532a9bb86b09878d4c6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d253233686f6170726f6a6563742d6666303036362e737667)](https://webchat.freenode.net/?channels=#hoaproject)[![Help on Gitter](https://camo.githubusercontent.com/8c4c85951788ff606b1268cb3dd946be05e3054795455d0a7b9250711bc2ac05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f68656c702d6769747465722d6666303036362e737667)](https://gitter.im/hoaproject/central)[![Documentation](https://camo.githubusercontent.com/7059ad5f1a363f9098686c59d432f01d7330aed9d4b6c8111d985fd64cfc6c60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d6861636b5f626f6f6b2d6666303036362e737667)](https://central.hoa-project.net/Documentation/Library/Mime)[![Board](https://camo.githubusercontent.com/fd81654ba14b3aca3a713e1b471bc3fc3ba7b5bb3761ccffd6eea2e2ed1fa5ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f7267616e69736174696f6e2d626f6172642d6666303036362e737667)](https://waffle.io/hoaproject/mime)

This library allows to manipulate a MIME types database and get some related informations about streams.

[Learn more](https://central.hoa-project.net/Documentation/Library/Mime).

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

[](#installation)

With [Composer](https://getcomposer.org/), to include this library into your dependencies, you need to require [`hoa/mime`](https://packagist.org/packages/hoa/mime):

```
$ composer require hoa/mime '~3.0'
```

For more installation procedures, please read [the Source page](https://hoa-project.net/Source.html).

Testing
-------

[](#testing)

Before running the test suites, the development dependencies must be installed:

```
$ composer install
```

Then, to run all the test suites:

```
$ vendor/bin/hoa test:run
```

For more information, please read the [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html).

Quick usage
-----------

[](#quick-usage)

As a quick overview, we will see how to get general and stream-related informations.

### General informations

[](#general-informations)

All we need is static methods `Hoa\Mime\Mime::getExtensionsFromMime` to get extensions from a type and `Hoa\Mime\Mime::getMimeFromExtension` to get type from an extension:

```
print_r(Hoa\Mime\Mime::getExtensionsFromMime('text/html'));

/**
 * Will output:
 *     Array
 *     (
 *         [0] => html
 *         [1] => htm
 *     )
 */

var_dump(Hoa\Mime\Mime::getMimeFromExtension('webm'));

/**
 * Will output:
 *     string(10) "video/webm"
 */
```

By default, `Hoa\Mime\Mime` uses the `hoa://Library/Mime/Mime.types` file as database. We can change this behavior by calling the `Hoa\Mime\Mime::compute`before any computations:

```
Hoa\Mime\Mime::compute('/etc/mime.types');
```

### Stream-related informations

[](#stream-related-informations)

By instanciating the `Hoa\Mime\Mime` class with a stream, we are able to get some informations about the stream, such as its extension, others extensions, type, etc. Thus:

```
$type = new Hoa\Mime\Mime(new Hoa\File\Read('index.html'));

var_dump(
    $type->getExtension(),
    $type->getOtherExtensions(),
    $type->getMime(),
    $type->isExperimental()
);

/**
 * Will output:
 *     string(4) "html"
 *     array(1) {
 *       [0]=>
 *       string(3) "htm"
 *     }
 *     string(9) "text/html"
 *     bool(false)
 */
```

Documentation
-------------

[](#documentation)

The [hack book of `Hoa\Mime`](https://central.hoa-project.net/Documentation/Library/Mime) contains detailed information about how to use this library and how it works.

To generate the documentation locally, execute the following commands:

```
$ composer require --dev hoa/devtools
$ vendor/bin/hoa devtools:documentation --open
```

More documentation can be found on the project's website: [hoa-project.net](https://hoa-project.net/).

Getting help
------------

[](#getting-help)

There are mainly two ways to get help:

- On the [`#hoaproject`](https://webchat.freenode.net/?channels=#hoaproject)IRC channel,
- On the forum at [users.hoa-project.net](https://users.hoa-project.net).

Contribution
------------

[](#contribution)

Do you want to contribute? Thanks! A detailed [contributor guide](https://hoa-project.net/Literature/Contributor/Guide.html) explains everything you need to know.

License
-------

[](#license)

Hoa is under the New BSD License (BSD-3-Clause). Please, see [`LICENSE`](https://hoa-project.net/LICENSE) for details.

Related projects
----------------

[](#related-projects)

The following projects are using this library:

- [E-Conf](https://gitlab.com/econf/econf), E-Conf is a Conference Management System,
- [sabre/katana](https://github.com/fruux/sabre-katana/), A contact, calendar, task list and file server.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity50

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 89.2% 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 ~60 days

Recently: every ~109 days

Total

15

Last Release

3437d ago

Major Versions

1.14.09.16 → 2.14.09.172014-09-17

2.15.10.29 → 3.16.01.112016-01-11

### Community

Maintainers

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

---

Top Contributors

[![Hywan](https://avatars.githubusercontent.com/u/946104?v=4)](https://github.com/Hywan "Hywan (91 commits)")[![vonglasow](https://avatars.githubusercontent.com/u/1275202?v=4)](https://github.com/vonglasow "vonglasow (4 commits)")[![stephpy](https://avatars.githubusercontent.com/u/232744?v=4)](https://github.com/stephpy "stephpy (2 commits)")[![bgetsug](https://avatars.githubusercontent.com/u/1869022?v=4)](https://github.com/bgetsug "bgetsug (1 commits)")[![shulard](https://avatars.githubusercontent.com/u/482993?v=4)](https://github.com/shulard "shulard (1 commits)")[![rexfordkelly](https://avatars.githubusercontent.com/u/3839452?v=4)](https://github.com/rexfordkelly "rexfordkelly (1 commits)")[![Grummfy](https://avatars.githubusercontent.com/u/668804?v=4)](https://github.com/Grummfy "Grummfy (1 commits)")[![limenet](https://avatars.githubusercontent.com/u/474329?v=4)](https://github.com/limenet "limenet (1 commits)")

---

Tags

hoalibrarymimemime-typesphptypemimelibrary

### Embed Badge

![Health badge](/badges/hoa-mime/health.svg)

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

###  Alternatives

[symfony/mime

Allows manipulating MIME messages

2.8k700.2M1.2k](/packages/symfony-mime)[zbateson/mail-mime-parser

MIME email message parser

54351.9M85](/packages/zbateson-mail-mime-parser)[zbateson/stream-decorators

PHP psr7 stream decorators for mime message part streams

4751.2M7](/packages/zbateson-stream-decorators)[xobotyi/php-mime-type

A comprehensive MIME-types lib for PHP.

317.2k](/packages/xobotyi-php-mime-type)[dflydev/canal

Content analysis for the purpose of determining Internet media types.

35122.9k2](/packages/dflydev-canal)

PHPackages © 2026

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