PHPackages                             axy/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. axy/mime

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

axy/mime
========

Mime-type matching

1.0.4(8y ago)0241MITPHPPHP &gt;=7.1.0

Since Dec 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/axypro/mime)[ Packagist](https://packagist.org/packages/axy/mime)[ Docs](https://github.com/axypro/mime)[ RSS](/packages/axy-mime/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (3)Versions (8)Used By (0)

axy\\mime
=========

[](#axymime)

Mime-type matching.

[![Latest Stable Version](https://camo.githubusercontent.com/29cbc6cbe3caccf99f6af72e9582529aee00f930d5b73b3eeaf5737cc5e45ac7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6178792f6d696d652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/axy/mime)[![Minimum PHP Version](https://camo.githubusercontent.com/dcd4b4aec2c1709157fa6a2c050f709d75cde9552a79cfff0b70a97fad7281ae/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/b3822ad86b3ff8fdc50bfbd9858d1991d02fd13bba60dd198aabbb29e6563f83/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f61787970726f2f6d696d652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/axypro/mime)[![Coverage Status](https://camo.githubusercontent.com/78f1c06fddda67664c8a9e730ddfb63b9a47dca9ce0d0684affafdf889e130cd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f61787970726f2f6d696d652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/axypro/mime?branch=master)[![License](https://camo.githubusercontent.com/c9c3d1e1ce5bb3218b29b0128ff98197c790394e5313ba021398cf1ec148b283/68747470733a2f2f706f7365722e707567782e6f72672f6178792f6d696d652f6c6963656e7365)](LICENSE)

- The library does not require any dependencies.
- Install: `composer require axy/mime`.
- License: [MIT](LICENSE).

For PHP 5.4+ support see branch `php54` in this repo or version 0.x of the composer package.

### Documentation

[](#documentation)

Mime-type has the follow format: `type/subtype`. For example: `image/png`. It is can be case-insensitive: `Image/PNG`.

Pattern can be in the follow formats:

- `image/png`
- `image/png,image/jpeg, image/gif` - a list of allowed types (comma-separated)
- `image/*` - all subtype of a type
- `image/*,text/plain` - a list contains a mask

#### Matching

[](#matching)

```
use axy\mime\MimeType;

$type = 'image/png';
$pattern = 'image/*';

MimeType::match($type, $pattern); // TRUE
```

Type and pattern can be strings or MimeType and MimePattern instances.

#### `MimeType` class

[](#mimetype-class)

```
use axy\mime\MimeType;

$type = new MimeType('Image/PNG');

echo $type->getMimeType(); // image/png
echo $type->getType(); // image
echo $type->getSubtype(); // png
echo $type->isType('image'); // TRUE
echo $type->isType(MimeType::AUDIO); // FALSE
```

The class has the constants list for common types: `APPLICATION`, `AUDIO`, `EXAMPLE`, `IMAGE`, `MESSAGE`, `MODEL`, `MULTIPART`, `TEXT` and `VIDEO`.

Matching:

```
$type = new MimeType('image/png');

$type->match('image/jpeg'); // FALSE
$type->match('image/*); // TRUE

$type('image/png'); // __invoke()

$type($instanceOfMimePattern); // see MimePattern
```

#### `MimePattern` class

[](#mimepattern-class)

```
use axy\mime\MimePattern;

$pattern = new MimePattern('IMAGE/*');

$pattern->getPattern(); // image/*

$pattern->match('image/png'); // TRUE
$pattern('image/jpeg'); // __invoke
$pattern($instanceOfMimeType);
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

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 ~0 days

Total

6

Last Release

3104d ago

Major Versions

0.1.0 → 1.0.02017-12-30

PHP version history (2 changes)0.1.0PHP &gt;=5.4.0

1.0.0PHP &gt;=7.1.0

### Community

Maintainers

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

---

Top Contributors

[![vasa-c](https://avatars.githubusercontent.com/u/557081?v=4)](https://github.com/vasa-c "vasa-c (11 commits)")

---

Tags

mime

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[symfony/mime

Allows manipulating MIME messages

2.8k716.9M1.3k](/packages/symfony-mime)[zbateson/mail-mime-parser

MIME email message parser

54753.3M89](/packages/zbateson-mail-mime-parser)[php-mime-mail-parser/php-mime-mail-parser

A fully tested email parser for PHP 8.2+ (mailparse extension wrapper).

1.0k10.4M35](/packages/php-mime-mail-parser-php-mime-mail-parser)[nette/mail

📧 Nette Mail: A handy library for creating and sending emails in PHP.

54010.2M273](/packages/nette-mail)[zbateson/stream-decorators

PHP psr7 stream decorators for mime message part streams

4752.6M9](/packages/zbateson-stream-decorators)[dflydev/apache-mime-types

Apache MIME Types

772.0M37](/packages/dflydev-apache-mime-types)

PHPackages © 2026

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