Detect the MIME type of source code files
MIME_Type_PlainDetect
Detect the MIME type of source code files.
A self-made MIME magic file to detect if a source code file is CSS, rST or SQL.
Download data/programming.magic
and then::
$ file -m programming.magic /path/to/file.css
text/css
See examples/mimedetect.php
::
require_once 'MIME/Type/PlainDetect.php';
$type = MIME_Type_PlainDetect::autoDetect($file);
if ($type == 'text/plain') {
//do something
}
::
$ pear channel-discover zustellzentrum.cweiske.de $ pear install zz/mime_type_plaindetect-alpha
::
$ composer require cweiske/mime_type_plaindetect
MIME_Type_PlainDetect is licensed under the OSL 3.0
__.
__ http://opensource.org/licenses/osl-3.0
MIME_Type_PlainDetect follows the PEAR Coding Standards
__.
__ http://pear.php.net/manual/en/standards.php
Written by Christian Weiske <http://cweiske.de/>
_.