Polyscope - The agent-first dev environment for Laravel

Laravel Getid3

owen-oj/laravel-getid3 image

Laravel Getid3 stats

Downloads
170.9K
Stars
64
Open Issues
0
Forks
11

View on GitHub →

This package is a wrapper around james-heinrich/getid3 to extract various information from media files

laravel-getid3

This package is a wrapper around james-heinrich/getid3.

Installation

Via Composer

$ composer require owen-oj/laravel-getid3

If you use Laravel 5.5+ you don't need the following step. If not, once package is installed, you need to register the service provider. Open config/app.php and add the following to the providers key.

Owenoj\LaravelGetId3\GetId3ServiceProvider::class,

Usage

use Owenoj\LaravelGetId3\GetId3;
 
//instantiate class with file
$track = new GetId3(request()->file('file'));
 
// Use static methods:
$track = GetId3::fromUploadedFile(request()->file('file'));
$track = GetId3::fromDiskAndPath('local', '/some/file.mp3');
$track = GetId3::fromDiskAndPath('s3', '/some/file.mp3'); // even works with S3
 
//get all info
$track->extractInfo();
 
//get title
$track->getTitle();
 
//get playtime
$track->getPlaytime();

We can also extract the artwork from the file

//calling this method will return artwork in base64 string
$track->getArtwork();
//Optionally you can pass can pass `true` to the method to get a jpeg version. This will return an UploadedFile instance
$track->getArtwork(true);

Available Methods

extractInfo() : array

Get an array of all available metadata of file

getArtist() : string

Get the artist of the track

getTitle() : string

Get the title of the track

getAlbum() : string

Get name of Album

getPlaytime() : string

Get a tracks total playtime

getPlaytimeSeconds() : float

Get total playtime in seconds

getArtwork()

Get the artwork of the track

getGenres() : array

Get the list of genres

getComposer() : string

Get the composers of the track

getTrackNumber() : string

Get the track number out of total number on album eg. 1/12

getCopyrightInfo() : string

Get copyright information of the track

getFileFormat() : string

Get the file format of the file eg. mp4

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email owen.j@terktrendz.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

Owen-oj photo

Full Stack Developer | DevOps Engineer

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Owen Oj Laravel Getid3 Related Articles

Laravel Zero 8 Released image

Laravel Zero 8 Released

Read article
How to add unlimited custom domains to Laravel Vapor image

How to add unlimited custom domains to Laravel Vapor

Read article
Five Minutes with Cory Smith from UltraRunning Magazine image

Five Minutes with Cory Smith from UltraRunning Magazine

Read article
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel
Statamic logo

Statamic

The drop-in ready Laravel CMS you’re been waiting for. Go full-stack or headless, flat file or database – it’s up to you.

Statamic
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten