ralouphie/mimey
Mimey is a lightweight PHP library that maps file extensions to MIME types and back. It ships with a comprehensive built-in mapping, requires no extensions, and offers simple methods like getMimeTypeFromExtension and getExtensionFromMimeType for reliable content-type detection in Laravel or any PHP...
.webp?" not "is this file actually a WebP?"Content-Type when serving generated, renamed, or proxied files, and for naming a file from a MIME type on export.Consider it when:
Look elsewhere when:
finfo/fileinfo, magic-byte sniffing, and scanning instead — Mimey should never be the gate.For executives: A free, MIT-licensed utility that eliminates a recurring class of bugs — inconsistent file-type tables copied across the codebase — for hours of integration rather than a sprint. No procurement or licensing friction, and negligible vendor risk because the package is small enough to replace or fork outright; we contain that risk by wrapping it behind an internal interface. Be precise about the boundary: it does not secure uploads, and we should not present it as doing so. Approve it as plumbing, and keep upload security as its own line item.
For engineering: One dependency, static arrays, two lookups. Use it for presentation-layer mapping — Content-Type headers, file-picker filters, download naming, type labels — and never for trust decisions on user-supplied files. Pin the version, hide it behind a small service so a future swap to Symfony Mime is a one-file change, and route all validation of untrusted uploads through content sniffing and scanning.
How can I help you explore Laravel packages today?