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.
Storage facade and Filesystem contracts but requires lightweight adaptation (e.g., wrapping DataUriInterface in a custom adapter).DataDecoder::decode() method’s versatility reduces the need for multiple libraries.stream_get_contents(), enabling low-memory processing of large files (e.g., videos, PDFs) without loading entire contents into RAM.data-uri-bundle repository has been merged into the main repository (PR #70). Architecturally this is a packaging/consolidation change, not an API change. For a Laravel TPM the practical read is:
Storage::put(), and that work is now insulated from the bundle’s release cadence.symfony/filesystem (v7.2/8.0), reducing conflict risks with Laravel’s ecosystem. Compatible with PHP 8.1+ and Laravel 10+.Filesystem adapters (e.g., s3, local).mime_content_type(), useful for preserving metadata (e.g., text/markdown). The type parameter in decode() allows overriding defaults.name parameter ensures original filenames are retained (critical for user uploads or debugging), addressing a common pain point in Laravel file handling.symfony/http-kernel, symfony/framework-bundle, symfony/dependency-injection) have leaked into the root composer.json require block. If they have, install footprint and conflict surface for a Laravel app grow materially; if they’re scoped to suggest/require-dev, impact is nil. This is a 5-minute composer why check and should gate adoption.FilesystemAdapter: Requires manual wrapping to integrate with Laravel’s Storage facade (e.g., Storage::put()). Unchanged by v7.0.3.Guzzle for HTTP validation).delete() method on DataUriInterface).memory_limit or upload_max_filesize may constrain processing..md as text/plain). Explicit types are recommended for reliability.data-uri-bundle repo will presumably be archived. Any downstream tooling, docs, or SBOM entries referencing it should be updated — housekeeping, not a blocker.FilesystemAdapter to enable seamless use with Storage::put()/Storage::disk()?Storage::put('temp-file', (new DataUriAdapter($decoder))->read($dataUri));InvalidDataUriException).Validator or middleware (e.g., reject non-HTTPS URLs).fread() loops)?symfony/mime worth adding for more robust MIME type detection?delete() method) for edge cases?Filesystem tests for compatibility?require entries to the root package that a Laravel 10/11 app would inherit?data-uri-bundle repo formally deprecated, and what is the recommended constraint for anyone (or any internal package) that still references it?DataUriInterface can be adapted to Laravel’s Filesystem contracts (e.g., Streamable, Readable) via a custom adapter. This enables use with Storage::put(), Storage::disk(), and background jobs.Http client (e.g., Http::get()) or Guzzle for remote URL handling.Validator or form request validation to sanitize data URIs before processing.symfony/filesystem (v7.2/8.0), which aligns with Laravel’s Symfony components. No conflicts expected.DataUriInterface ensures thread safety.composer update 1tomany/data-uri --with-dependencies in a branch.composer.lock for new transitive requires introduced by the bundle merge; reject the bump if Symfony HTTP/framework components appear as hard requires.data-uri-bundle package is not installed anywhere in our dependency graph (composer why).DataDecoder::decode().data:image/png;base64,...).https://example.com/file.pdf).storage/uploads/file.jpg).$name parameter).DataUriFilesystemAdapter implementing Laravel’s Filesystem contracts:
class DataUriAdapter implements Filesystem
{
public function read($path): string { ... }
public function write($path, $contents, $options = []): void { ... }
// ... other contract methods
}
Storage facade:
Storage::extend('data_uri', function () {
return new DataUriAdapter(new DataDecoder());
});
data_uri rule in Laravel’s Validator).DataUriInterface in queued jobs (e.g., ConvertUploadToPermanentStorageJob).symfony/filesystem (v7.2/8.0): Already used by Laravel.symfony/mime for enhanced MIME detection (not required).sys_get_temp_dir()).^7.0 and treat 7.0.x as drop-in. No constraint change required for this release.DataDecoder::decode() for broad use cases (data URIs, URLs, files).decodeBase64(), decodeText()) for performance-critical paths (e.g., API responses).Storage facade.symfony/filesystem) reduce maintenance burden — contingent on Phase 0 confirming the bundle merge didn’t inflate the root requirement set.mimeType → format in v6.0.0).$name parameter) aids troubleshooting.type for anything user-facing.@viccherubini); bus factor remains 1. The repo consolidation slightly improves continuity (one repo to watch/fork) but does not change the single-maintainer risk. Our adapter layer doubles as the escape hatch if upstream stalls.sys_get_temp_dir()). In multi-node or autoscaled deployments, decode-then-persist must complete within the same request/job; do not assume a decoded temp file survives a node handoff./tmp utilization and inode counts — this is the most likely scaling cliff.| Failure | Trigger | Blast Radius | Mitigation |
|---|---|---|---|
| Malformed data URI | Client-supplied payload | Request/job error | Custom exception + Laravel Validator rule |
| SSRF via remote URL | Untrusted URL passed to decoder | Internal network exposure | HTTPS-only allowlist, block private CIDR ranges, egress controls |
| Temp-disk exhaustion | Large/burst payloads | Node-wide failures | Quotas, memory_limit/upload_max_filesize tuning, alerting on /tmp |
| Premature file deletion | Long-lived object in worker | Silent missing-file errors | Restrict decoded objects to method scope; re-decode on retry |
| MIME misclassification | Auto-detection on ambiguous files | Downstream processing errors | Explicit type for all user-supplied content |
| Dependency surprise from bundle merge | v7.0.3 install pulls Symfony HTTP/Kernel | Composer resolution conflict with Laravel | Phase 0 lockfile diff; hold the bump if hard requires appear |
| Upstream abandonment | Single maintainer | Long-term | Adapter layer isolates us; fork is viable (MIT, small codebase) |
DataDecoder::decode(); 2–3 weeks for the adapter + validation work (unchanged by v7.0.3).How can I help you explore Laravel packages today?