mimey
mimey copied to clipboard
Audio/mp3 not working, returning null
Code
use Mimey\MimeTypes;
$mimes = new MimeTypes();
$extension = $mimes->getExtension('audio/mp3');
echo $extension;
Expected
mp3
Output
null
Hi @renjithspace, thanks for your reply.
Do you refer the mime.types doc?
The audio/mpeg
includes following extensions:
# audio/mpa-robust
audio/mpeg mpga mp2 mp2a mp3 m2a m3a
That is, you have to use following code snippets to accomplish expected behavior:
use Mimey\MimeTypes;
$mimes = new MimeTypes();
$mimes->getExtension('audio/mpeg'); // "mp3"
If you want to get all extensions for audio/mpeg
, using the following method:
$mimes->getAllExtensions('audio/mpeg');
The output array is as follows:
[
"mp3",
"mpga",
"mp2",
"mp2a",
"m2a",
"m3a",
]
@ralouphie, do you have any idea about this :)?