1tomany/data-uri
Convert data URIs, base64 strings, files, and HTTP/HTTPS URLs into temporary file value objects. The decoder infers MIME types and filenames, supports custom names and types, and auto-deletes temporary files when destroyed.
Simplification of File Handling Workflows:
Enhanced Media Processing Capabilities:
data:image/png;base64,... in responses).Lower Integration Cost on Symfony Stacks (v7.0.3):
data-uri-bundle project has been merged into the main repository, so the Symfony bundle now ships and versions alongside the core library.Roadmap Priorities for Scalability:
clientName parameter).Cross-Functional Use Cases:
data:image/png;base64,...) into Laravel for storage, analysis, or transformation.Adopt When:
Look Elsewhere If:
Filesystem or Storage facade for saving).Guzzle for HTTP validation).Storage driver). v7.0.3 improves Symfony integration only — Laravel still requires a thin adapter.FileField, Ruby’s ActiveStorage).*"This PHP package solves a common but tedious problem: converting data URIs, base64 strings, or remote files into temporary files with proper MIME types and filenames—automatically. It’s like giving your developers a Swiss Army knife for file handling without the overhead of building or maintaining custom solutions.
Why It Matters:
Impact:
Ask: Should we allocate a spike to test this in our file upload pipeline and benchmark it against our current solution?"*
*"The 1tomany/data-uri package provides a robust, low-effort way to parse data URIs (RFC 2397), base64 strings, and remote files into temporary files with auto-deletion. Here’s why it’s worth adopting:
Key Features:
mime_content_type()), with extensions for custom formats.data-uri-bundle is now published from this repository, so the bundle and core library share a version and release cycle. Drop the standalone bundle dependency, let Composer resolve a single version, and delete any compatibility shims or pinned version constraints between the two.Storage facade with minimal wrapper code.Proposed Integration:
DataDecoder::decode() in upload handlers or API response processors to convert data URIs into temporary files.
$file = (new DataDecoder())->decode($dataUri, $originalFilename, 'image/png');
decodeBase64() for API responses containing embedded assets (e.g., data:image/jpeg;base64,...).name parameter to retain original filenames (critical for user experience).composer.lock, and re-run bundle config/DI tests — this is a dependency consolidation, not an API change.Technical Considerations:
Filesystem contracts (e.g., wrap DataUriInterface in a custom adapter). The v7.0.3 consolidation signals maintainer appetite for framework glue — a candidate for a small upstream contribution instead of permanent forked wrapper code.Storage for persistent files.Next Steps:
composer.json for the old bundle package, consolidate to a single requirement, and verify in CI. Low effort, immediate reduction in maintenance surface.FilesystemAdapter for seamless use with the Storage facade.Guzzle) to validate remote URLs before processing.Risk Mitigation:
symfony/filesystem), now with one fewer package to audit upstream.Question: Should we prioritize this for the next file-handling refactor, or explore alternatives like [league/flysystem] for broader storage needs?"*
How can I help you explore Laravel packages today?