Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Mimey Laravel Package

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...

Deep Wiki
Context7

PHP package for converting file extensions to MIME types and vice versa.

Frequently asked questions about Mimey
How do I install ralouphie/mimey in a Laravel application?
Add it with composer require ralouphie/mimey. Laravel does not require a service provider for basic use; instantiate Mimey\MimeTypes directly or bind it in a service provider. Run composer dump-autoload if needed and confirm the package supports your PHP version.
Which Laravel and PHP versions does Mimey support?
The repository metadata in this assessment is unknown, so confirm PHP and Laravel constraints from Packagist and the package composer.json before adopting. Mimey is framework-agnostic PHP and does not require a Laravel service provider. Test it against your application's PHP runtime and Laravel release in CI rather than assuming support.
How do I get a MIME type from a file extension with Mimey?
Instantiate Mimey\MimeTypes and call getMimeTypeFromExtension('jpg') to receive image/jpeg. Pass the extension without the leading dot. Wrap the call in your own resolver so controllers and jobs do not depend on the vendor class directly.
How do I get a file extension from a MIME type using Mimey?
Call getExtensionFromMimeType('image/jpeg') to receive a common extension such as jpg. Some MIME types map to multiple extensions, so review the library mapping behavior and decide how to choose or validate the returned value. Prefer storing the original filename and detected MIME separately in your application.
Does Mimey return null for unknown extensions or MIME types?
Mimey is a static mapping table, so unknown extensions or MIME types normally produce no mapping rather than a guessed value. Write contract tests for the values you rely on and always handle null or empty results with a documented fallback. Do not let a missing mapping break download headers or upload flows.
Can I use Mimey for secure file upload validation?
No. Mimey maps names to types; it does not inspect file contents. Use PHP finfo/fileinfo, framework upload validation, and server-side content checks for security decisions. Mimey is suitable for metadata, UX labels, and non-security-critical routing only.
How does Mimey handle uppercase extensions and compound extensions?
Mappings are table-driven, so uppercase extensions and multi-part names can behave differently than expected. Normalize extensions to lowercase before lookup and define how you handle names like .tar.gz or .blade.php. Add tests for the exact file types your application accepts.
Is Mimey actively maintained, and what happens if it is abandoned?
Assess Packagist release history and issue activity because repository metadata here is unknown. If maintenance stalls, pin the version and own a fallback mapping table for critical types. A quarterly review of dependency health and mapping gaps is prudent.
How do I bind Mimey as a singleton or wrap it in a Laravel service?
Bind Mimey\MimeTypes as a singleton in AppServiceProvider and inject it behind an application-owned MimeTypeResolver interface. This keeps calls testable and lets you swap implementations later. Avoid calling the vendor class directly from controllers, jobs, or validation rules.
What are alternatives to Mimey for MIME detection in Laravel?
Alternatives include PHP's finfo/fileinfo extension for content sniffing, Laravel's UploadedFile getMimeType and getClientMimeType helpers, and the Symfony Mime component. Mimey differs by providing deterministic extension-to-MIME mapping without inspecting file contents. Use it alongside, not instead of, content-based detection.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle