PHPackages                             imonroe/mimeutils - 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. imonroe/mimeutils

ActiveLibrary

imonroe/mimeutils
=================

A helper for working with MIME types, particularly for validating uploads.

0.1.0(8y ago)05481MITPHPPHP ~5.6|~7.0

Since Apr 22Pushed 8y ago1 watchersCompare

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

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

mime\_utils
===========

[](#mime_utils)

A helper class for working with MIME types. Should be particularly useful for validating file uploads.

Based on the MIME type list [found here.](https://gist.github.com/tylerlee/53609bff1346cebf8f0a85b6be29a88e)

Install
-------

[](#install)

Via Composer

```
$ composer require imonroe/mime_utils
```

Usage
-----

[](#usage)

```
  $allowed_mimes = new MimeUtils;
  // You can allow all the available types:
  $allowed_mimes->allow_all();

  // or you can allow just certain subtypes:
  $allowed_mimes->allow('image');
  $allowed_mimes->allow('video');

  // text types include htm, html, css
  $allowed_mimes->allow('text');
  $allowed_mimes->allow('audio');

  // The application types allow potentially problematic types, e.g., pdf, swf, js, class
  // enable it only if necessary.
  $allowed_mimes->allow('application');
  $allowed_mimes->allow('ms-office');
  $allowed_mimes->allow('open-office');
  $allowed_mimes->allow('wordperfect');
  $allowed_mimes->allow('iwork');

  // You can get the allowed extenstions as a string:
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('string');
  // or as an array:
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('array');
  // or as JSON:
  $mime_string = 'mimes:' . $allowed_mimes->get_extensions('json');

  // You can also get the types in the same way, in the same formats:
  $mime_string = 'mimes:' . $allowed_mimes->get_types('string');
  // or
  $mime_string = 'mimes:' . $allowed_mimes->get_types('array');
  // or
  $mime_string = 'mimes:' . $allowed_mimes->get_types('json');
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ian Monroe](https://www.ianmonroe.com)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

2944d ago

### Community

Maintainers

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

---

Top Contributors

[![imonroe](https://avatars.githubusercontent.com/u/1263892?v=4)](https://github.com/imonroe "imonroe (2 commits)")

---

Tags

mimetypesimonroemimeutils

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/imonroe-mimeutils/health.svg)

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

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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