PHPackages                             borschphp/mimetype - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. borschphp/mimetype

ActiveLibrary[HTTP &amp; Networking](/categories/http)

borschphp/mimetype
==================

MimeType and MediaType implementation.

1.0.0(4y ago)05MITPHPPHP ^7.2 || ^8.0

Since Nov 26Pushed 4y agoCompare

[ Source](https://github.com/borschphp/borsch-mimetype)[ Packagist](https://packagist.org/packages/borschphp/mimetype)[ Docs](https://github.com/borschphp/borsch-mimetype)[ RSS](/packages/borschphp-mimetype/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Mime Types
==========

[](#mime-types)

[![Latest Stable Version](https://camo.githubusercontent.com/23064083f78e99f109ce639bc8e1d8fd36c1e7fd0f27667fa3a35f6430c736c9/687474703a2f2f706f7365722e707567782e6f72672f626f727363687068702f6d696d65747970652f76)](https://packagist.org/packages/borschphp/mimetype)[![License](https://camo.githubusercontent.com/25695a45898733f6a50c0ad4483ba9d7c016b3ccb0ea5809f8b395238e0661b8/687474703a2f2f706f7365722e707567782e6f72672f626f727363687068702f6d696d65747970652f6c6963656e7365)](https://packagist.org/packages/borschphp/mimetype)[![PHP Version Require](https://camo.githubusercontent.com/03d5b6e6d8a326e76fead5df72eb42e7ace85dd6c6a157121b4d2e310f38c487/687474703a2f2f706f7365722e707567782e6f72672f626f727363687068702f6d696d65747970652f726571756972652f706870)](https://packagist.org/packages/borschphp/mimetype)[![build](https://github.com/borschphp/borsch-mimetype/actions/workflows/php.yml/badge.svg)](https://github.com/borschphp/borsch-mimetype/actions/workflows/php.yml)[![Code Coverage](https://camo.githubusercontent.com/47d6c3f0cd19f44cf0453773cf6aada3b60104acfc351f41b845be5929c9e53d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626f727363687068702f626f727363682d6d696d65747970652f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/borschphp/borsch-mimetype/?branch=main)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/5f5d9d1043c66f62ccbb3ef74d52181192ea068154c39ccb69977f65ea592219/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f626f727363687068702f626f727363682d6d696d65747970652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/borschphp/borsch-mimetype/?branch=main)

MimeType and MediaType implementation.

Install
-------

[](#install)

This project requires PHP 7.2 or higher.
Via [Composer](https://getcomposer.org/), simply run:

```
composer require borschphp/mimetype
```

Basic Usage
-----------

[](#basic-usage)

Easily create Mime Type for your requests:

```
use Borsch\MimeType\MimeType;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\Uri;

$mime_type = new MimeType('application', 'json', ['charset' => 'UTF-8']);

$request = (new Request())
    ->withUri(new Uri('http://example.com'))
    ->withMethod('GET')
    ->withAddedHeader('Content-Type', (string)$mime_type);
```

Or Media Type:

```
use Borsch\MimeType\MediaType;
use Laminas\Diactoros\Request;
use Laminas\Diactoros\Uri;

$request = (new Request())
    ->withUri(new Uri('http://example.com'))
    ->withMethod('GET')
    ->withAddedHeader('Content-Type', MediaType::APPLICATION_JSON);
```

Parse Mime Types and get useful data:

```
use Borsch\MimeType\MimeType;
use Borsch\MimeType\MediaType;

$mime_type = MimeType::createFromString(
    'application/atom+xml;charset=utf-8;boundary=3d6b6a416f9b5;name=some_file'
);

$mime_type->getType(); // application
$mime_type->getSubtype(); // atom+xml
$mime_type->getSubtypeSuffix() // xml
$mime_type->getCharset(); // utf-8
$mime_type->getParameters(); // ['charset' => 'utf-8', 'boundary' => '3d6b6a416f9b5', 'name' => 'some_file']
$mime_type->getParameter('boundary'); // 3d6b6a416f9b5

$media_type = new MediaType('image', 'png', ['q' => 0.8]);
$media_type->getQualityValue(); // 0.8
$media_type->removeQualityValue();
$media_type->getQualityValue(); // null
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](https://github.com/borschphp/borsch-mimetype/blob/main/CONTRIBUTING.md) for details.

Testing
-------

[](#testing)

Made with [PHPUnit](https://phpunit.de/), simply run:

```
./vendor/bin/phpunit tests
```

License
-------

[](#license)

This project is licensed under the MIT license.
See the [LICENSE.md](https://github.com/borschphp/borsch-mimetype/blob/main/LICENSE.md) file for more details.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1633d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1a70117520fe10a630d61c750bbe6888d174e9903825e741470f818ee2c5d1?d=identicon)[debuss-a](/maintainers/debuss-a)

---

Top Contributors

[![debuss](https://avatars.githubusercontent.com/u/2537607?v=4)](https://github.com/debuss "debuss (15 commits)")

---

Tags

psrpsr-7mimetypemediatype

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/borschphp-mimetype/health.svg)

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

###  Alternatives

[psr/http-message

Common interface for HTTP messages

7.1k1.0B5.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[laminas/laminas-diactoros

PSR HTTP Message implementations

546105.8M965](/packages/laminas-laminas-diactoros)[fig/http-message-util

Utility classes and constants for use with PSR-7 (psr/http-message)

39489.0M274](/packages/fig-http-message-util)[psr/http-server-handler

Common interface for HTTP server-side request handler

175101.3M921](/packages/psr-http-server-handler)[psr/http-server-middleware

Common interface for HTTP server-side middleware

18091.2M1.5k](/packages/psr-http-server-middleware)

PHPackages © 2026

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