Skip to content
This repository has been archived by the owner on Sep 17, 2020. It is now read-only.
/ file-detector Public archive

MIME type detector for partial file streams of unlimited length

License

Notifications You must be signed in to change notification settings

ancarda/file-detector

Repository files navigation

ancarda/file-detector

MIME type detector for partial file streams of unlimited length

Latest Stable Version Total Downloads License Build Status Coverage Status

file-detector is a library for PHP 7.0+ that accepts a file stream of any length, even if it's a partial file type, and provides a MIME detector for it.

The detector class can be used with any framework and has no dependencies. This library may be installed via composer with the following command:

composer require ancarda/file-detector

The detector can then be initalized and used, like so. For example:

<?php

$resource = fopen('example.jpg', 'r');
$detector = new \Ancarda\File\Detector;
$mimetype = $detector->determineMimeType($resource);

//$mimetype is now 'image/jpg'

Releases

No releases published

Packages

No packages published

Languages