Repository navigation
Make ext-fileinfo optional and drop composer suggest - #724
Merged
Merged
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
November 10, 2026 09:04
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The newly supported configuration lacks test coverage because the only new test requires fileinfo and is skipped, leaving the exception guidance and explicit MIME-type bypass unverified.
1 open issue
What changed in this PR
This PR makes fileinfo optional, allowing SDK installation without it while providing an actionable exception when file-based content needs MIME detection.
Changes:
- Centralizes MIME detection and missing-extension handling across content factories.
- Removes Composer suggestions and documents the optional-dependency policy.
- Adds a MIME-detection unit test and updates installation guidance and the changelog.
| File | Description |
|---|---|
| tests/Unit/Schema/Content/MimeTypeTest.php | Tests MIME detection with fileinfo available. |
| src/Schema/Content/MimeType.php | Adds shared detection and an installation-guidance exception. |
| src/Schema/Content/ImageContent.php | Uses shared MIME detection for image files. |
| src/Schema/Content/EmbeddedResource.php | Uses shared detection in file-based resource factories. |
| src/Schema/Content/BlobResourceContents.php | Uses shared detection for file-backed blobs. |
| src/Schema/Content/AudioContent.php | Uses shared MIME detection for audio files. |
| docs/get-started/installation.md | Explains explicit MIME types when fileinfo is unavailable. |
| composer.json | Removes the fileinfo requirement and dependency suggestions. |
| CHANGELOG.md | Records optional fileinfo support. |
| AGENTS.md | Documents runtime checks for optional dependencies. |
Review effort: Balanced
Comment on lines
+28
to
+29
| if (!\function_exists('mime_content_type')) { | ||
| throw new LogicException(\sprintf('Detecting the MIME type of "%s" requires the "fileinfo" PHP extension. Install it or pass the MIME type explicitly.', $path)); |
chr-hertel
force-pushed
the
optional-fileinfo
branch
from
November 10, 2026 09:42
708a8f0 to
15e496c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Only the content factories that read a file need
fileinfo, and only when no MIME type is given, so it no longer blocks installing the SDK. Like Symfony, optional dependencies are no longer listed undersuggest: the code paths that need them throw an exception that names what to install.