altocompta/vendor/horstoeko/mimedb
2025-08-03 16:45:50 +02:00
..
.github OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
build OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
examples OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
src OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
tests OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
.gitignore OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
build.ant.xml OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
build.xml OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
CODE_OF_CONDUCT.md OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
composer.json OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
CONTRIBUTING.md OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
LICENSE OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
README.md OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00
SECURITY.md OTP : set double authentication : create, send link, usable with Google Authenticator and FreeOTP 2025-08-03 16:45:50 +02:00

MimeDB

Latest Stable Version PHP version License

Build Status Release Status

Table of Contents

License

The code in this project is provided under the MIT license.

Overview

With horstoeko/mimedb you can receive mimetypes by file extension and visa versa.

Dependencies

This package has no dependencies.

Installation

There is one recommended way to install horstoeko/mimedb via Composer:

  • adding the dependency to your composer.json file:
  "require": {
      ..
      "horstoeko/mimedb":"^1",
      ..
  },

Usage

For detailed eplanation you may have a look in the examples of this package and the documentation attached to every release.

Get all MimeTypes by file extensions

use horstoeko\mimedb\MimeDb;

require dirname(__FILE__) . "/../vendor/autoload.php";

$mimeDb = MimeDb::singleton();

// OUTPUT:
//   application/vnd.openxmlformats-officedocument.wordprocessingml.document

echo $mimeDb->findFirstMimeTypeByExtension('.docx') . PHP_EOL;

// OUTPUT:
//   application/vnd.openxmlformats-officedocument.wordprocessingml.document

foreach ($mimeDb->findAllMimeTypesByExtension('.docx') as $mimetype) {
    echo $mimetype . PHP_EOL;
}

Get all file extensions by MimeType


use horstoeko\mimedb\MimeDb;

error_reporting(E_ERROR | E_WARNING | E_PARSE);

$mimeDb = MimeDb::singleton();

// OUTPUT:
//   docx

echo $mimeDb->findFirstFileExtensionByMimeType('application/vnd.openxmlformats-officedocument.wordprocessingml.document') . PHP_EOL;

// OUTPUT:
//   mkv
//   mk3d
//   mks

foreach ($mimeDb->findAllFileExtensionsByMimeType('video/x-matroska') as $fileExtension) {
    echo $fileExtension . PHP_EOL;
}

// OUTPUT:
//   docx

foreach ($mimeDb->findAllFileExtensionsByMimeType('application/vnd.openxmlformats-officedocument.wordprocessingml.document') as $fileExtension) {
    echo $fileExtension . PHP_EOL;
}