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

Getid3 Laravel Package

phansys/getid3

phansys/getid3 is a PHP wrapper around the getID3 library for extracting metadata from audio and video files, including ID3 tags, duration, bitrate, dimensions, and codec details. Useful for media uploads, cataloging, and validating files in Laravel or any Composer project.

View on GitHub
Deep Wiki
Context7

Getting Started

This bundle is a Symfony2-era wrapper around the standalone getid3/getid3 library. As a Laravel developer, the practical takeaway is that the bundle's DI wiring is useless to you—but the vendored getID3 library underneath is fully usable and framework-agnostic.

Install and inspect first:

composer require phansys/getid3
composer show phansys/getid3            # confirm what got pulled in
ls vendor/phansys/getid3               # find the bundle + getid3 core

Look first at vendor/phansys/getid3 for the Bundle class, then at vendor/getid3/getid3/getid3.php (the actual analyzer). The Bundle class itself is your only "integration" surface; the real API is getID3:

require base_path('vendor/getid3/getid3/getid3.php');

$getID3 = new \getID3();
$info = $getID3->analyze(storage_path('app/public/upload.mp3'));

$title  = $info['tags']['id3v2']['title'][0] ?? null;
$artist = $info['tags']['id3v2']['artist'][0] ?? null;
$duration = $info['playtime_seconds'] ?? null;

Your first real use case: reading metadata from user-uploaded audio/video (title, artist, album, duration, bitrate, cover art) so you can display it and populate an Eloquent model.

Implementation Patterns

Wrap it in your own service. Don't call getID3 directly from controllers. Create App\Services\MediaAnalyzer that instantiates getID3, runs analyze(), and returns a normalized array/DTO. Inject it via a Laravel service provider and bind an interface if you plan to swap analyzers later.

Queue the analysis. analyze() is CPU- and memory-heavy on large or corrupt files. Dispatch a AnalyzeMediaMetadata job after the upload is stored, then persist to the model from the job:

public function handle(MediaAnalyzer $analyzer)
{
    $info = $analyzer->analyze(Storage::disk('public')->path($this->media->path));
    $this->media->update([
        'duration' => $info['playtime_seconds'],
        'title'    => data_get($info, 'tags.id3v2.title.0'),
        'bitrate'  => $info['bitrate'] ?? null,
    ]);
}

Normalize across container formats. ID3v2, ID3v1, and format-specific tags (e.g. $info['audio']) land in different keys. Write a single mapper that tries tags.id3v2, then tags.id3v1, then comments, and always falls back through ?? null. This is the number one thing that makes the package usable day-to-day.

Extract cover art from $info['comments']['picture'][0]['data'] and write it to your storage disk—useful for audio players and listing pages.

Use it for validation, not just metadata. $info['fileformat'], $info['audio']['dataformat'], and $info['mime_type'] let you reject files whose extension lies about their content, complementing Laravel's mimes: rule.

Gotchas and Tips

It is not a Laravel package. There is no service provider, no auto-discovery, no facade. The phansys/getid3 namespace is PSR-0 style and geared at Symfony's AppKernel/services.yml. Budget time to hand-roll the integration; do not expect php artisan vendor:publish to do anything useful.

The bundle is effectively unmaintained (0 dependents, no active Symfony/Laravel support). Pin the exact version in composer.lock, review the transitive getid3/getid3 source before shipping, and treat the bundle layer as optional—often you only want the underlying library.

getID3 wants real filesystem paths, not Laravel stream abstractions. Always resolve with Storage::disk(...)->path($file) (or ->get() to a temp file) rather than passing a URL or stream wrapper.

Memory and timeouts bite. Large video files can consume hundreds of MB and run for seconds. Set memory_limit/max_execution_time explicitly in the job, and consider $getID3->option_max_2gb_check = true and disabling unused scan options to speed things up.

Silence the library's own noise. Old getID3 code emits warnings and notices on malformed files. Wrap analyze() in a try/catch and either set an error handler around it or suppress errors deliberately—otherwise corrupt uploads will spam logs and can surface as 500s.

Debug via $info. Dump the whole array once per format you support; the structure differs meaningfully between MP3, MP4, and FLAC. Save a fixture per format and assert your normalizer against them in tests.

Extension points are the $getID3->option_* properties and per-format sub-modules (e.g. getid3_id3v2); if you need custom tag handling, extend at that level rather than patching the bundle.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource