Feature: #60019 - New SplFileInfo implementation with new mimeTypeGuessers hook

See Issue #60019


A new class \TYPO3\CMS\Core\Type\File\FileInfo which extends SplFileInfo is now available as an API for fetching meta information from files.

Besides the native .. _SplFileInfo API: http://php.net/manual/en/class.splfileinfo.php, it provides a new method getMimeType() to get the mime type of a file, e.g. text/html. It uses the native PHP function finfo_file() and mime_content_type() as a fallback.

Example: Get the MIME type of a file

$fileIdentifier = '/tmp/foo.html';
$fileInfo = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Type\File\FileInfo::class, $fileIdentifier);
echo $fileInfo->getMimeType();
// text/html

New Hook 'mimeTypeGuessers'

Custom implementations to determine the MIME type can be added with a hook. Register the hook as follows: