Download the PHP package intervention/mimesniffer without Composer
On this page you can find all versions of the php package intervention/mimesniffer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download intervention/mimesniffer
More information about intervention/mimesniffer
Files in intervention/mimesniffer
Package mimesniffer
Short Description PHP MIME Type Sniffer
License MIT
Homepage http://intervention.io/
Informations about the package mimesniffer
PHP Media type (MIME) detector
Detecting MIME Content-type in PHP is easy with
mime_content_type
or Fileinfo. But Fileinfo as
an extension is sometimes not available on the server. The function
mime_content_type
wants a path to the filesystem as argument and doesn't
process if we only have a string value. This package makes it easy to detect
the mime types of the content of a given file or string, without any extension
dependencies.
Installation
Install the package easily via composer:
Usage
Here are some code samples, to show how the library is handled.
If your prefer non-static initialization:
Currently only the following file types can be detected. More will be added in a next release.
Images
- Image encoded as JPEG raw or in the JFIF or Exif file format
- Image file encoded in the Graphics Interchange Format (GIF)
- Image encoded in the Portable Network Graphics format (PNG)
- Image encoded as BMP file, a bitmap format
- Image encoded in High Efficiency Image File Format (HEIC/HEIF)
- Icon encoded in ICO file format
- Image in Google WebP image format
- Scalable Vector Graphics (SVG)
- Tagged Image File Format (TIFF)
- Image encoded Photoshop Document file format (PSD)
- AV1 Image File Format (AVIF)
- JPEG 2000 File Format
Archives
- GZIP compressed
- ZIP file
- RAR archive
- TAR file
Videos
- AVI
- MPEG-1 and MPEG-2 video
- MKV media container
Audio
- MP3 file
- FLAC file
Other
- PDF document
- OGG media container
- SQLite Database
- application/octet-stream (default binary)
- text/plain (default)
Contributing
Contributions are welcome. Please note the following guidelines before submiting your pull request.
- Follow PSR-2 coding standards.
- Write tests for new functions and added features
Development & Testing
With this package comes a Docker image to build a test suite and analysis container. To build this container you have to have Docker installed on your system. You can run all tests with this command.
Run the static analyzer on the code base.
Authors
This library is developed and maintained by Oliver Vogel
License
Intervention MimeSniffer is licensed under the MIT License.