Bånder

Id3v2
in package

This class represents a file containing ID3v2 tags.

ID3v2 is a flexible tagging format that stores metadata at the beginning of the audio file. It supports various types of frames for different kinds of metadata, including images.

Table of Contents

Properties

$encoding  : int
$filePath  : string
$frames  : array<string|int, mixed>
$version  : int

Methods

__construct()  : mixed
Constructs the Id3v2 class with given file.
getApicFrame()  : Apic|null
Returns the APIC frame (APIC).
getCOMMFrame()  : COMM|null
Returns the first comment frame (COMM).
getCOMMFrameByDescription()  : COMM|null
Returns a comment frame with the given description.
getCOMMFrames()  : array<string|int, COMM>
Returns the comment frames (COMM).
getEQUAFrame()  : EQUA|null
Returns the equalization frame (EQUA).
getETCOFrame()  : ETCO|null
Returns the event timing codes frame (ETCO).
getFramesByIdentifier()  : array<string|int, mixed>
Returns all frames with the given identifier.
getIPLSFrame()  : IPLS|null
Returns the involved people list frame (IPLS).
getLINKFrame()  : LINK|null
Returns the first linked information frame (LINK).
getLINKFrames()  : array<string|int, LINK>
Returns the linked information frames (LINK).
getMCDIFrame()  : MCDI|null
Returns the music CD identifier frame (MCDI).
getMVINFrame()  : MVIN|null
Returns the movement number frame (MVIN).
getOWNEFrame()  : OWNE|null
Returns the ownership frame (OWNE).
getPOPMFrame()  : POPM|null
Returns the first popularimeter frame (POPM).
getPOPMFrameByEmail()  : POPM|null
Returns a popularimeter frame with the given email.
getPOPMFrames()  : array<string|int, POPM>
Returns the popularimeter frames (POPM).
getSYLTFrame()  : SYLT|null
Returns the first synchronized lyric/text frame (SYLT).
getSYLTFrameByDescription()  : SYLT|null
Returns a synchronized lyric/text frame with the given description.
getSYLTFrames()  : array<string|int, SYLT>
Returns the synchronized lyric/text frames (SYLT).
getTALBFrame()  : TALB|null
Returns the album frame (TALB).
getTCOMFrame()  : TCOM|null
Returns the composer frame (TCOM).
getTCONFrame()  : TCON|null
Returns the genre frame (TCON).
getTDATFrame()  : TDAT|null
Returns the date frame (TDAT).
getTEXTFrame()  : TEXT|null
Returns the lyricist/text writer frame (TEXT).
getTIT2Frame()  : TIT2|null
Returns the title frame (TIT2).
getTLANFrame()  : TLAN|null
Returns the language frame (TLAN).
getTLENFrame()  : TLEN|null
Returns the length frame (TLEN).
getTORYFrame()  : TORY|null
Returns the original release year frame (TORY).
getTPE1Frame()  : TPE1|null
Returns the artist frame (TPE1).
getTPE2Frame()  : TPE2|null
Returns the band/orchestra/accompaniment frame (TPE2).
getTPE3Frame()  : TPE3|null
Returns the conductor/performer refinement frame (TPE3).
getTPE4Frame()  : TPE4|null
Returns the interpreted, remixed, or otherwise modified by frame (TPE4).
getTPUBFrame()  : TPUB|null
Returns the publisher frame (TPUB).
getTRCKFrame()  : TRCK|null
Returns the track number frame (TRCK).
getTSRCFrame()  : TSRC|null
Returns the ISRC frame (TSRC).
getTYERFrame()  : TYER|null
Returns the year frame (TYER).
getUSLTFrame()  : USLT|null
Returns the first unsynchronized lyric/text transcription frame (USLT).
getUSLTFrameByDescription()  : USLT|null
Returns an unsynchronized lyric/text transcription frame with the given description.
getUSLTFrames()  : array<string|int, USLT>
Returns the unsynchronized lyric/text transcription frames (USLT).
getVersion()  : int
Returns the version of the ID3v2 tag.
removeCOMMFrameByDescription()  : self
Removes a comment frame with the given description.
removeCOMMFrames()  : self
Removes all comment frames (COMM).
setApicFrame()  : self
Sets the APIC frame (APIC).
setCOMMFrame()  : self
Sets a comment frame (COMM).
setTALBFrame()  : self
Sets the album frame (TALB).
setTCOMFrame()  : self
Sets the composer frame (TCOM).
setTCONFrame()  : self
Sets the genre frame (TCON).
setTDATFrame()  : self
Sets the date frame (TDAT).
setTEXTFrame()  : self
Sets the lyricist/text writer frame (TEXT).
setTIT2Frame()  : self
Sets the title frame (TIT2).
setTLANFrame()  : self
Sets the language frame (TLAN).
setTLENFrame()  : self
Sets the length frame (TLEN).
setTORYFrame()  : self
Sets the original release year frame (TORY).
setTPE1Frame()  : self
Sets the artist frame (TPE1).
setTPE2Frame()  : self
Sets the band/orchestra/accompaniment frame (TPE2).
setTPE3Frame()  : self
Sets the conductor/performer refinement frame (TPE3).
setTPE4Frame()  : self
Sets the interpreted, remixed, or otherwise modified by frame (TPE4).
setTPUBFrame()  : self
Sets the publisher frame (TPUB).
setTRCKFrame()  : self
Sets the track number frame (TRCK).
setTSRCFrame()  : self
Sets the ISRC frame (TSRC).
setTYERFrame()  : self
Sets the year frame (TYER).
write()  : void
Writes the ID3v2 tag to the file.
createFrame()  : Frame|null
Creates a frame object based on the frame ID.
parse()  : void
Parses the ID3v2 tag from the file.
parseFrames()  : void
Parses the frames from the tag data.
processFrame()  : void
Processes a frame based on its ID.

Properties

$encoding

private int $encoding = \App\Modules\Metadata\MediaMeta\Encoding::UTF8

$filePath

private string $filePath

$frames

private array<string|int, mixed> $frames = []

$version

private int $version = 0

Methods

__construct()

Constructs the Id3v2 class with given file.

public __construct(string $filePath[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$filePath : string

The path to the audio file

$options : array<string|int, mixed> = []

Options for reading the tag

Tags
throws
Exception

if the file cannot be read or does not contain ID3v2 tags

getApicFrame()

Returns the APIC frame (APIC).

public getApicFrame() : Apic|null
Return values
Apic|null

The APIC frame, or null if not available

getCOMMFrame()

Returns the first comment frame (COMM).

public getCOMMFrame() : COMM|null
Return values
COMM|null

The comment frame, or null if not available

getCOMMFrameByDescription()

Returns a comment frame with the given description.

public getCOMMFrameByDescription(string $description) : COMM|null
Parameters
$description : string

The description

Return values
COMM|null

The comment frame, or null if not available

getCOMMFrames()

Returns the comment frames (COMM).

public getCOMMFrames() : array<string|int, COMM>
Return values
array<string|int, COMM>

The comment frames

getEQUAFrame()

Returns the equalization frame (EQUA).

public getEQUAFrame() : EQUA|null
Return values
EQUA|null

The equalization frame, or null if not available

getETCOFrame()

Returns the event timing codes frame (ETCO).

public getETCOFrame() : ETCO|null
Return values
ETCO|null

The event timing codes frame, or null if not available

getFramesByIdentifier()

Returns all frames with the given identifier.

public getFramesByIdentifier(string $identifier) : array<string|int, mixed>
Parameters
$identifier : string

The frame identifier

Return values
array<string|int, mixed>

The frames

getIPLSFrame()

Returns the involved people list frame (IPLS).

public getIPLSFrame() : IPLS|null
Return values
IPLS|null

The involved people list frame, or null if not available

getLINKFrame()

Returns the first linked information frame (LINK).

public getLINKFrame() : LINK|null
Return values
LINK|null

The linked information frame, or null if not available

getLINKFrames()

Returns the linked information frames (LINK).

public getLINKFrames() : array<string|int, LINK>
Return values
array<string|int, LINK>

The linked information frames

getMCDIFrame()

Returns the music CD identifier frame (MCDI).

public getMCDIFrame() : MCDI|null
Return values
MCDI|null

The music CD identifier frame, or null if not available

getMVINFrame()

Returns the movement number frame (MVIN).

public getMVINFrame() : MVIN|null
Return values
MVIN|null

The movement number frame, or null if not available

getOWNEFrame()

Returns the ownership frame (OWNE).

public getOWNEFrame() : OWNE|null
Return values
OWNE|null

The ownership frame, or null if not available

getPOPMFrame()

Returns the first popularimeter frame (POPM).

public getPOPMFrame() : POPM|null
Return values
POPM|null

The popularimeter frame, or null if not available

getPOPMFrameByEmail()

Returns a popularimeter frame with the given email.

public getPOPMFrameByEmail(string $email) : POPM|null
Parameters
$email : string

The email

Return values
POPM|null

The popularimeter frame, or null if not available

getPOPMFrames()

Returns the popularimeter frames (POPM).

public getPOPMFrames() : array<string|int, POPM>
Return values
array<string|int, POPM>

The popularimeter frames

getSYLTFrame()

Returns the first synchronized lyric/text frame (SYLT).

public getSYLTFrame() : SYLT|null
Return values
SYLT|null

The synchronized lyric/text frame, or null if not available

getSYLTFrameByDescription()

Returns a synchronized lyric/text frame with the given description.

public getSYLTFrameByDescription(string $description) : SYLT|null
Parameters
$description : string

The description

Return values
SYLT|null

The synchronized lyric/text frame, or null if not available

getSYLTFrames()

Returns the synchronized lyric/text frames (SYLT).

public getSYLTFrames() : array<string|int, SYLT>
Return values
array<string|int, SYLT>

The synchronized lyric/text frames

getTALBFrame()

Returns the album frame (TALB).

public getTALBFrame() : TALB|null
Return values
TALB|null

The album frame, or null if not available

getTCOMFrame()

Returns the composer frame (TCOM).

public getTCOMFrame() : TCOM|null
Return values
TCOM|null

The composer frame, or null if not available

getTCONFrame()

Returns the genre frame (TCON).

public getTCONFrame() : TCON|null
Return values
TCON|null

The genre frame, or null if not available

getTDATFrame()

Returns the date frame (TDAT).

public getTDATFrame() : TDAT|null
Return values
TDAT|null

The date frame, or null if not available

getTEXTFrame()

Returns the lyricist/text writer frame (TEXT).

public getTEXTFrame() : TEXT|null
Return values
TEXT|null

The lyricist/text writer frame, or null if not available

getTIT2Frame()

Returns the title frame (TIT2).

public getTIT2Frame() : TIT2|null
Return values
TIT2|null

The title frame, or null if not available

getTLANFrame()

Returns the language frame (TLAN).

public getTLANFrame() : TLAN|null
Return values
TLAN|null

The language frame, or null if not available

getTLENFrame()

Returns the length frame (TLEN).

public getTLENFrame() : TLEN|null
Return values
TLEN|null

The length frame, or null if not available

getTORYFrame()

Returns the original release year frame (TORY).

public getTORYFrame() : TORY|null
Return values
TORY|null

The original release year frame, or null if not available

getTPE1Frame()

Returns the artist frame (TPE1).

public getTPE1Frame() : TPE1|null
Return values
TPE1|null

The artist frame, or null if not available

getTPE2Frame()

Returns the band/orchestra/accompaniment frame (TPE2).

public getTPE2Frame() : TPE2|null
Return values
TPE2|null

The band/orchestra/accompaniment frame, or null if not available

getTPE3Frame()

Returns the conductor/performer refinement frame (TPE3).

public getTPE3Frame() : TPE3|null
Return values
TPE3|null

The conductor/performer refinement frame, or null if not available

getTPE4Frame()

Returns the interpreted, remixed, or otherwise modified by frame (TPE4).

public getTPE4Frame() : TPE4|null
Return values
TPE4|null

The interpreted, remixed, or otherwise modified by frame, or null if not available

getTPUBFrame()

Returns the publisher frame (TPUB).

public getTPUBFrame() : TPUB|null
Return values
TPUB|null

The publisher frame, or null if not available

getTRCKFrame()

Returns the track number frame (TRCK).

public getTRCKFrame() : TRCK|null
Return values
TRCK|null

The track number frame, or null if not available

getTSRCFrame()

Returns the ISRC frame (TSRC).

public getTSRCFrame() : TSRC|null
Return values
TSRC|null

The ISRC frame, or null if not available

getTYERFrame()

Returns the year frame (TYER).

public getTYERFrame() : TYER|null
Return values
TYER|null

The year frame, or null if not available

getUSLTFrame()

Returns the first unsynchronized lyric/text transcription frame (USLT).

public getUSLTFrame() : USLT|null
Return values
USLT|null

The unsynchronized lyric/text transcription frame, or null if not available

getUSLTFrameByDescription()

Returns an unsynchronized lyric/text transcription frame with the given description.

public getUSLTFrameByDescription(string $description) : USLT|null
Parameters
$description : string

The description

Return values
USLT|null

The unsynchronized lyric/text transcription frame, or null if not available

getUSLTFrames()

Returns the unsynchronized lyric/text transcription frames (USLT).

public getUSLTFrames() : array<string|int, USLT>
Return values
array<string|int, USLT>

The unsynchronized lyric/text transcription frames

getVersion()

Returns the version of the ID3v2 tag.

public getVersion() : int
Return values
int

removeCOMMFrameByDescription()

Removes a comment frame with the given description.

public removeCOMMFrameByDescription(string $description) : self
Parameters
$description : string

The description

Return values
self

removeCOMMFrames()

Removes all comment frames (COMM).

public removeCOMMFrames() : self
Return values
self

setApicFrame()

Sets the APIC frame (APIC).

public setApicFrame(string $imagePath, string $imageType) : self
Parameters
$imagePath : string

The path to the image file

$imageType : string

The image type (e.g. "image/jpeg")

Return values
self

setCOMMFrame()

Sets a comment frame (COMM).

public setCOMMFrame(string $text[, string $description = '' ][, string $language = 'eng' ]) : self
Parameters
$text : string

The comment text

$description : string = ''

The description

$language : string = 'eng'

The language code

Return values
self

setTALBFrame()

Sets the album frame (TALB).

public setTALBFrame(string $album) : self
Parameters
$album : string

The album

Return values
self

setTCOMFrame()

Sets the composer frame (TCOM).

public setTCOMFrame(string $composer) : self
Parameters
$composer : string

The composer

Return values
self

setTCONFrame()

Sets the genre frame (TCON).

public setTCONFrame(string $genre) : self
Parameters
$genre : string

The genre

Return values
self

setTDATFrame()

Sets the date frame (TDAT).

public setTDATFrame(string $date) : self
Parameters
$date : string

The date (DDMM format)

Return values
self

setTEXTFrame()

Sets the lyricist/text writer frame (TEXT).

public setTEXTFrame(string $lyricist) : self
Parameters
$lyricist : string

The lyricist/text writer

Return values
self

setTIT2Frame()

Sets the title frame (TIT2).

public setTIT2Frame(string $title) : self
Parameters
$title : string

The title

Return values
self

setTLANFrame()

Sets the language frame (TLAN).

public setTLANFrame(string $language) : self
Parameters
$language : string

The language code(s)

Return values
self

setTLENFrame()

Sets the length frame (TLEN).

public setTLENFrame(string $length) : self
Parameters
$length : string

The length in milliseconds

Return values
self

setTORYFrame()

Sets the original release year frame (TORY).

public setTORYFrame(string $year) : self
Parameters
$year : string

The original release year

Return values
self

setTPE1Frame()

Sets the artist frame (TPE1).

public setTPE1Frame(string $artist) : self
Parameters
$artist : string

The artist

Return values
self

setTPE2Frame()

Sets the band/orchestra/accompaniment frame (TPE2).

public setTPE2Frame(string $band) : self
Parameters
$band : string

The band/orchestra/accompaniment

Return values
self

setTPE3Frame()

Sets the conductor/performer refinement frame (TPE3).

public setTPE3Frame(string $conductor) : self
Parameters
$conductor : string

The conductor/performer refinement

Return values
self

setTPE4Frame()

Sets the interpreted, remixed, or otherwise modified by frame (TPE4).

public setTPE4Frame(string $modifier) : self
Parameters
$modifier : string

The interpreter/remixer/modifier

Return values
self

setTPUBFrame()

Sets the publisher frame (TPUB).

public setTPUBFrame(string $publisher) : self
Parameters
$publisher : string

The publisher

Return values
self

setTRCKFrame()

Sets the track number frame (TRCK).

public setTRCKFrame(string $track) : self
Parameters
$track : string

The track number

Return values
self

setTSRCFrame()

Sets the ISRC frame (TSRC).

public setTSRCFrame(string $isrc) : self
Parameters
$isrc : string

The ISRC

Return values
self

setTYERFrame()

Sets the year frame (TYER).

public setTYERFrame(string $year) : self
Parameters
$year : string

The year

Return values
self

write()

Writes the ID3v2 tag to the file.

public write() : void
Tags
throws
Exception

if the file cannot be written

createFrame()

Creates a frame object based on the frame ID.

private createFrame(string $frameId, string $frameData) : Frame|null
Parameters
$frameId : string
$frameData : string
Return values
Frame|null

parse()

Parses the ID3v2 tag from the file.

private parse() : void
Tags
throws
Exception

if the file cannot be read or does not contain ID3v2 tags

parseFrames()

Parses the frames from the tag data.

private parseFrames(string $tagData) : void
Parameters
$tagData : string

The tag data

processFrame()

Processes a frame based on its ID.

private processFrame(string $frameId, string $frameData) : void
Parameters
$frameId : string

The frame ID

$frameData : string

The frame data


        
On this page

Search results