Download the PHP package moudarir/mime-detector without Composer

On this page you can find all versions of the php package moudarir/mime-detector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mime-detector

MIME Detector

Latest Version Tests PHP Version Require License

⚠️ Deprecated

moudarir/mime-detector is no longer maintained and has been deprecated in favor of moudarir/file.

The new package provides file resource management, file metadata and MIME type detection in a single abstraction.

New projects should use moudarir/file instead.

A PHP library for detecting the real MIME type of files by analyzing their content.

Unlike extension-based detection, this library relies on multiple detection strategies:

The goal is to provide a reliable MIME type detection based on the actual file content.

Requirements

Installation

Install the package using Composer:

Detection Process

The detection pipeline follows a strict order:

Each detector returns:

The first successful detection is returned.


Supported Formats

Images


Documents


Archives


ZIP-based Containers

The library can identify specialized ZIP containers by inspecting their internal structure.

Microsoft Office Open XML

OpenDocument

Other containers

Detection is based on the internal ZIP structure, not the file extension.


Audio


Video


Executables


Disk Image


Text Formats

The library detects common text-based formats:

Generic text files are handled by PHP FileInfo when no specialized format is detected.


Separated Values


Example

Detecting a PDF file:

Output:

Mime Type

Detector

Metadata


Design Principles

Content over extension

The file extension is never used as the primary source of truth.

Example:

A file named:

containing a PDF document will be detected as:


Performance Considerations

The library includes several optimizations:


Limitations

MIME detection is not a complete security validation mechanism.

A file can have a valid MIME type while still containing malicious content.

This library should not replace:

It only identifies the actual file format.


License

MIT License


All versions of mime-detector with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4 <9.0
ext-fileinfo Version *
ext-zip Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package moudarir/mime-detector contains the following files

Loading the files please wait ...