ralouphie / mimey

PHP package for converting file extensions to MIME types and vice versa.
MIT License
324 stars 87 forks source link

question: are assertions out of scope? #10

Closed jpuck closed 6 years ago

jpuck commented 7 years ago

Now it's easy enough to check if an extension matches a media subtype

$extension = 'mp4';
if ( $mimes->getMimeType($extension) === 'video/mp4' ) {
    // ...
}

Would you consider a PR to extend support for asserting media supertypes?

e.g.

$extensions = [
    'mp4',
    'avi',
    'mkv',
];

foreach ( $extensions as $extension ) {
    if ( $mimes->isMediaType('video', $extension) ) {
        // returns true
    }
}

I understand that this is encroaching on the fringes of this lib's scope, but because it's such a standard use case, I was curious if you'd be open to it?

thanks

ralouphie commented 6 years ago

Yes, I would consider this out of scope, this only aims to provide a simple mapping between MIME type and extension :)