wapmorgan/mp3info
A pure-PHP library for reading MP3 metadata without external tools or extensions. It parses ID3v1 and ID3v2 tags along with audio properties such as duration, bitrate, sample rate, and channels, making it easy to inspect music files in any PHP application.
Architecture fit. wapmorgan/mp3info is a framework-agnostic, pure-PHP parser — no PHP extensions, no external binaries, no service dependency. It slots in as an infrastructure-level utility: a single class you instantiate against a file path and read duration, bitRate, sampleRate, and ID3v1/v2 tags from. That is a good architectural shape for a Laravel app: it does not assume the framework, does not register service providers, and does not impose configuration. The trade-off is that it also gives you nothing for free — no facade, no config, no queue or storage-disk integration. You own the wrapper, the validation rules, and the error handling. Treat it as a dependency of your own AudioMetadataExtractor service, not as a feature in itself.
Integration feasibility. Low friction. Composer install, a thin adapter class, and a queued job — a mid-level engineer can have a working vertical slice in under a day. The real integration work is not the library call; it is deciding what your domain model does when metadata is missing, malformed, or disagrees with the file the user thought they uploaded.
Technical risk.
APIC) can pull megabytes into memory for a single tag read. "Fastest" is a self-reported claim with no published benchmark harness — do not inherit it as an assumption.Key questions.
Stack fit. Laravel 10–12 on PHP 8.1+ is a clean fit; the package has a small dependency surface and is unlikely to conflict with media packages you already run. Do not call it directly from controllers or models. Define an interface — AudioMetadataExtractor returning a small DTO — with an Mp3InfoExtractor implementation. That interface is the actual architectural decision; the library is a swappable detail behind it.
Migration path. If you are on getID3 today, this is not a rip-and-replace. Map only the fields your product actually consumes (duration, bitrate, sample rate, title/artist/album, artwork), implement the new adapter to that contract, and run both in shadow mode for one release cycle — parse every upload with both, log deltas, and only cut over once the divergence rate is understood and explained. Keep the old path behind a feature flag for at least one cycle after cutover.
Compatibility. Verify the package's PHP constraint against your pinned runtime and confirm no transitive conflicts via composer why-not. Check behavior differences across your supported PHP minor versions before standardising. If you are on Laravel Vapor or another read-only/ephemeral filesystem, confirm the library accepts a local stream path — upload to a temp path, parse, then delete.
Sequencing.
getID3 and ffprobe on a curated corpus of 500–1,000 real uploads spanning CBR, VBR, unicode tags, large files, and deliberate corruption.timeout and memory_limit, plus retry/backoff and a terminal "metadata unavailable" state.metadata_source and metadata_confidence column so you can audit and re-run later.Maintenance. Low surface area, stable release history, but effectively single-maintainer. Pin exact versions, avoid ^ ranges on this one, and be prepared to vendor-fork under LGPL terms if upstream stalls. Because modification triggers LGPL's publish-your-changes obligation, prefer wrapping over patching — patch only if you accept that constraint.
Support. Community only. No vendor escalation. Budget a named internal owner and assume GitHub issues are your sole upstream channel; SLA expectations should be set accordingly with stakeholders.
Scaling. CPU- and IO-bound, horizontally scalable by adding workers. Isolate it on a dedicated media-processing queue so a bulk backfill of hour-long podcasts does not starve user-facing jobs. Cap worker memory conservatively and consider discarding APIC frames when artwork is not needed on the hot path — or extract artwork through a separate, more tightly limited code path. Throughput planning should be driven by your own benchmark numbers, not the package's marketing claim.
Failure modes.
failed_jobs.Ramp-up. Low for the API itself — an afternoon for a competent PHP developer. The genuine learning curve is MP3 domain knowledge: VBR/Xing headers, ID3 version differences, and why a tag parse can succeed while the duration is nonsense. Document those quirks alongside the wrapper, and make the validation rules part of the service contract so the next engineer does not have to rediscover them.
How can I help you explore Laravel packages today?