Skip to content

xylphid/php-id3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-ID3

PHP-ID3 is a native php lib for ID3 tags

Compatibility

PHP-ID3 is tested on the following PHP version :

  • PHP 8.2

Installation

composer install xylphid/php-id3

Usage

PHP Script

Step by step extraction :

use Id3\Id3;

$media = '/path/to/media/file.mp3';
$id3 = new Id3Parser();
$id3->setFilename($media);
$id3->processFile();

Auto process :

$media = '/path/to/media/file.mp3';
$id3 = new Id3Parser($media);

Found tags are registered as object properties and named according to Id3 specifications. You can display tags with :

if ($id3->isCompliant()) {
    printf("Title : %s\n", $id3->getTitle());
    printf("Artist : %s\n", $id3->getArtist());
    printf("Album : %s\n", $id3->getAlbum());
    printf("Track : %s\n", $id3->getTrack());
    printf("PartOfSet : %s\n", $id3->getPartOfSet());
    printf("Genre : %s\n", $id3->getGenre());
    printf("Year : %s\n", $id3->getYear());
    printf("Duration : %s\n", $id3->getDuration())
}

About

PHP native library for id3 tag

Resources

Stars

Watchers

Forks

Packages

No packages published