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

Data Uri Bundle Laravel Package

1tomany/data-uri-bundle

Symfony bundle wrapping 1tomany/data-uri: auto-configures a denormalizer for TemporaryFileInterface objects and adds a console command to encode files as base64 data URIs. No configuration needed.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Framing the "inline media" question, not answering it. This package only matters once you've decided you want file bytes embedded directly in JSON/HTML payloads (Data URIs) rather than referenced by URL. That's a product decision with real trade-offs — payload size grows ~33% from base64 overhead, responses become uncacheable per-asset, and browser caching stops working. Use this package's README as the starting point for that debate; don't use it as justification to skip the debate.
  • Build vs. buy → build (or buy the underlying library, not the bundle). The bundle is a thin Symfony wrapper: one serializer normalizer/denormalizer (DataUriNormalizer) plus one console command (onetomany:data-uri:encode-file). In a Laravel codebase, the equivalent is a handful of lines — base64_encode(Storage::get($path)) and a mime-type lookup, or a Laravel Cast/API Resource. There is no meaningful logic to outsource here.
  • Platform fit is the decisive constraint. This is a Symfony bundle, not a Laravel package. It auto-wires through Symfony's DI container and depends on symfony/serializer. Laravel's default JSON serialization (JsonResource, Eloquent casts) does not use Symfony's Serializer, so the bundle's core value — the auto-tagged denormalizer — delivers nothing out of the box. Adopting it means pulling in symfony/serializer and hand-wiring it into a Laravel app, or abandoning the bundle and using 1tomany/data-uri directly.
  • Roadmap: keep "embedded assets" as a scoped experiment, not a platform bet. If the feature is genuinely wanted (admin thumbnails, self-contained transactional emails, offline PWA manifests), define it as an isolated capability with an explicit size budget (e.g. <100KB per asset) and a URL fallback above the threshold. Do not let it become the default representation of media in your API surface.
  • Use cases worth prototyping: inline thumbnails/previews in admin dashboards, inline email images (where Data URIs are the standard workaround for image blocking/remote-content stripping), favicon and critical-icon inlining, and small config/placeholder assets.
  • Use cases to rule out explicitly: user uploads, anything over ~1MB, PDFs and documents, and any endpoint whose response size you monitor against gateway limits.
  • Vendor/continuity risk is a first-class product input. The bundle is archived, has 0 stars, 0 dependents, and the README documents no configuration options and no usage examples beyond installation. That's not a dependency you adopt; it's a pattern you copy.

When to Consider This Package

Adopt only if all of the following hold:

  • You are on Symfony (with symfony/serializer already in the stack) and want DataUriInterface-typed DTO properties to denormalize automatically, with zero config.
  • Your assets are small and bounded (icons, thumbnails, previews), and you have a documented fallback to URLs above a size threshold.
  • You are comfortable reading the underlying 1tomany/data-uri source, because the bundle ships no meaningful docs, no usage examples, and has no community to answer questions.
  • You have accepted that you will likely fork or vendor the code: it is archived, MIT-licensed, and has no dependents, so upstream fixes are not coming.

Look elsewhere if any of the following apply — which, for most teams, they will:

  • You are on Laravel. This is the most likely reason you're reading this. The bundle's Symfony DI/serializer wiring is dead weight; use base64_encode + Storage::get() in an API Resource, a custom cast, or intervention/image for resizing. Reach for 1tomany/data-uri directly only if you want its validation and mime handling.
  • You need to handle uploads or large files. Base64 bloat (~33%) plus gateway response limits (client_max_body_size, CloudFront/LB limits) plus per-request CPU for encoding make this a poor fit. Use signed URLs, a CDN, or spatie/laravel-medialibrary with conversions.
  • You need transformations (resize, crop, format negotiation) as part of generating the URI. That's an image-pipeline concern — Spatie + Glide/Cloudinary/imgproxy — not a serialization concern.
  • You care about caching. Data URIs are opaque to browser and CDN caching. If asset caching is load-bearing for your performance budget, this is a regression, not an improvement.
  • You can't accept an unmaintained dependency. Archived + 0 dependents + a single-author project is a hard no for anything on a critical path, regardless of MIT license.
  • You need error handling guarantees. Nothing in the docs describes behavior on unreadable paths, corrupt binaries, symlinks, non-UTF8 filenames, or remote/cloud storage (S3, Flysystem). Assume you'll write and own all of that.

How to Pitch It (Stakeholders)

Bottom line for the decision meeting: recommend do not adopt; recommend copy the pattern if the underlying feature is valuable.

For executives (30 seconds):

"This is a tiny Symfony add-on that lets you paste file contents straight into API responses instead of linking to them. It's not for our stack — we're on Laravel, and it's built for Symfony — and it's formally archived with no users or maintainers, so we'd own it forever. The capability it describes is genuinely small: embedding a thumbnail as text is roughly a dozen lines of our own code. My recommendation is to treat 'inline small assets' as a product feature we may want, and build it ourselves in a day, rather than adopt a dead dependency. It does not affect the roadmap."

For engineering (the real conversation):

"1tomany/data-uri-bundle is a Symfony bundle: one auto-tagged serializer normalizer/denormalizer for DataUriInterface, plus a onetomany:data-uri:encode-file console command. Zero configuration, and therefore zero documentation.

  • Stack fit: it depends on symfony/serializer and Symfony's DI. Laravel doesn't serialize through Symfony's Serializer, so the bundle's only real value — auto-denormalization — is inert for us. Using it means bolting Symfony Serializer onto Laravel, which is more integration risk than the feature removes.
  • Health: 0 stars, 0 dependents, archived, last release 2026-07-31, single author. MIT, so forking is legal and straightforward, but we'd be the maintainers.
  • What it actually does: base64-encode a file with a mime-type prefix. That's it. In Laravel this is a cast or an API Resource method over Storage::get().
  • Where it bites: ~33% payload inflation; no browser/CDN caching for embedded assets; no streaming; no cloud-storage path handling; no documented error behavior for missing/corrupt/non-UTF8 files; response-size limits on the gateway.
  • Proposal: if we want inline previews (admin thumbnails, inline email images), I'll write a small DataUri value object + cast with a hard size cap and a URL fallback, behind a feature flag, scoped to one endpoint. Half a day, no new dependency, no archived code.

Ask: confirm we don't want to pull symfony/serializer into the app; approve the half-day spike on the admin-thumbnail endpoint."

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.
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support