Download the PHP package kiwilan/php-audio without Composer
On this page you can find all versions of the php package kiwilan/php-audio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kiwilan/php-audio
More information about kiwilan/php-audio
Files in kiwilan/php-audio
Package php-audio
Short Description PHP package to parse and update audio files metadata, with `JamesHeinrich/getID3`.
License MIT
Homepage https://github.com/kiwilan/php-audio
Informations about the package php-audio
PHP Audio
PHP package to parse and update audio files metadata, with JamesHeinrich/getID3
.
[!NOTE]
You can check formats supported on Supported formats section.
About
Audio files can use different formats, this package aims to provide a simple way to read them with JamesHeinrich/getID3
. The JamesHeinrich/getID3
package is excellent to read metadata from audio files, but output is just an array, current package aims to provide a simple way to read audio files with a beautiful API.
Requirements
- PHP
8.1
minimum - Optional for update
FLAC
:flac
(withapt
,brew
orscoop
)OGG
:vorbis-tools
(withapt
orbrew
) /extras/icecast
(withscoop
)
Roadmap
- Add support for more formats with external packages
Installation
You can install the package via composer:
Usage
Core metadata:
Raw tags:
Additional metadata:
You can use toArray()
method to get raw info:
Advanced properties:
Update
You can update audio files metadata with Audio::class
, but not all formats are supported. See supported formats
[!WARNING]
You can use any property of
Audio::class
but if you use a property not supported by the format, it will be ignored.
Some properties are not supported by all formats, for example MP3
can't handle some properties like lyrics
or stik
, if you try to update these properties, they will be ignored.
Set tags manually
You can set tags manually with tag()
or tags()
methods, but you need to know the format of the tag, you could use tagFormats
to set formats of tags (if you don't know the format, it will be automatically detected).
[!WARNING]
If you use
tags
method, you have to use key used by metadata container. For example, if you want to set album artist inid3v2
, you have to useband
key. If you want to know which key to use checksrc/Core/AudioCore.php
file.If your key is not supported,
save
method will throw an exception, unless you useskipErrors
.
Arrow functions
Skip errors
You can use skipErrors
to prevent exception if you use unsupported format.
[!NOTE]
Arrow functions are exception safe for properties but not for unsupported formats.
Raw tags
Audio files format metadata with different methods, JamesHeinrich/getID3
offer to check these metadatas by different methods. In raw_all
property of Audio::class
, you will find raw metadata from JamesHeinrich/getID3
package, like id3v2
, id3v1
, riff
, asf
, quicktime
, matroska
, ape
, vorbiscomment
...
If you want to extract specific field which can be skipped by Audio::class
, you can use raw_all
property.
AudioMetadata
Quicktime
For quicktime
type, like for M4B audiobook, you can use Id3TagQuicktime
to get more informations.
AudioCover
Supported formats
Readable formats
id3v2
will be selected beforeid3v1
orriff
if both are available.
Format | Supported | About | ID3 type | Notes |
---|---|---|---|---|
AAC | ❌ | Advanced Audio Coding | ||
ALAC | ✅ | Apple Lossless Audio Codec | quicktime |
|
AIF | ✅ | Audio Interchange File Format (aif) | id3v2 ,riff |
|
AIFC | ✅ | Audio Interchange File Format (aifc) | id3v2 ,riff |
|
AIFF | ✅ | Audio Interchange File Format (aiff) | id3v2 ,riff |
|
DSF | ❌ | Direct Stream Digital Audio | ||
FLAC | ✅ | Free Lossless Audio Codec | vorbiscomment |
|
MKA | ✅ | Matroska | matroska |
Cover not supported |
MKV | ✅ | Matroska | matroska |
Cover not supported |
APE | ❌ | Monkey's Audio | ||
MP3 | ✅ | MPEG audio layer 3 | id3v2 ,id3v1 |
|
MP4 | ✅ | Digital multimedia container format | quicktime |
Partially supported |
M4A | ✅ | mpeg-4 audio | quicktime |
|
M4B | ✅ | Audiobook | quicktime |
|
M4V | ✅ | mpeg-4 video | quicktime |
|
MPC | ❌ | Musepack | ||
OGG | ✅ | Open container format | vorbiscomment |
|
OPUS | ✅ | IETF Opus audio | vorbiscomment |
|
OFR | ❌ | OptimFROG | ||
OFS | ❌ | OptimFROG | ||
SPX | ✅ | Speex | vorbiscomment |
Cover not supported |
TAK | ❌ | Tom's Audio Kompressor | ||
TTA | ✅ | True Audio | ape |
Cover not supported |
WMA | ✅ | Windows Media Audio | asf |
Cover not supported |
WV | ✅ | WavPack | ape |
|
WAV | ✅ | Waveform Audio | id3v2 ,riff |
|
WEBM | ✅ | WebM | matroska |
Cover not supported |
You want to add a format? See FAQ
Updatable formats
JamesHeinrich/getID3
can update some formats, but not all.
- ID3v1 (v1 & v1.1)
- ID3v2 (v2.3, v2.4)
- APE (v2)
- Ogg Vorbis comments (need
vorbis-tools
)- FLAC comments (need
flac
)
Format | Notes | Requires |
---|---|---|
FLAC | Cover not supported | flac |
MP3 | ||
OGG | Cover not supported | vorbis-tools |
flac
: withapt
,brew
orscoop
vorbis-tools
: withapt
,brew
orscoop
- With
scoop
,vorbis-tools
is not available, you can useextras/icecast
instead.
- With
Convert properties
Audio::class
convert some properties to be more readable.
ape
format:Id3TagApe
asf
format:Id3TagAsf
id3v1
format:Id3TagAudioV1
id3v2
format:Id3TagAudioV2
matroska
format:Id3TagMatroska
quicktime
format:Id3TagQuicktime
vorbiscomment
format:Id3TagVorbisComment
riff
format:Id3TagRiff
unknown
format:Id3TagVorbisComment
ID3 type | Original | New property |
---|---|---|
id3v2 |
band |
album_artist |
id3v2 |
part_of_a_set |
disc_number |
id3v2 |
part_of_a_compilation |
is_compilation |
quicktime |
compilation |
is_compilation |
quicktime |
encoded_by |
encoding_by |
quicktime |
encoding_tool |
encoding |
quicktime |
description_long |
synopsis |
asf |
albumartist |
album_artist |
asf |
partofset |
disc_number |
asf |
encodingsettings |
encoding |
vorbiscomment |
encoder |
encoding |
vorbiscomment |
albumartist |
album_artist |
vorbiscomment |
discnumber |
disc_number |
vorbiscomment |
compilation |
is_compilation |
vorbiscomment |
tracknumber |
track_number |
matroska |
disc |
disc_number |
matroska |
part_number |
track_number |
matroska |
date |
year |
matroska |
compilation |
is_compilation |
matroska |
encoder |
encoding |
ape |
disc |
disc_number |
ape |
compilation |
is_compilation |
ape |
track |
track_number |
ape |
date |
year |
ape |
encoder |
encoding |
Testing
Tools
- ffmpeg: free and open-source software project consisting of a suite of libraries and programs for handling video, audio, and other multimedia files and streams.
- MP3TAG: powerful and easy-to-use tool to edit metadata of audio files (free on Windows).
- Audiobook Builder: makes it easy to turn audio CDs and files into audiobooks (only macOS and paid).
- Tag Editor: A tag editor with Qt GUI and command-line interface supporting MP4/M4A/AAC (iTunes), ID3, Vorbis, Opus, FLAC and Matroska.
- Tag Editor: a spreadsheet application for editing audio metadata in a simple, fast, and flexible way.
FAQ
I have a specific metadata field in my audio files, what can I do?
In Audio::class
, you have a property raw_all
which contains all raw metadata, if JamesHeinrich/getID3
support this field, you will find it in this property.
If your field could be added to global properties of Audio::class
, you could create an an issue.
Metadata are null
, what can I do?
You can check extras
property to know if some metadata are available.
If you find metadata which are not parsed by Audio::class
, you can create an issue, otherwise JamesHeinrich/getID3
doesn't support this metadata.z
My favorite format is not supported, what can I do?
You can create an issue with the format name and a link to the format documentation. If JamesHeinrich/getID3
support this format, I will add it to this package but if you want to contribute, you can create a pull request with the format implementation.
Please give me an example file to test the format.
I have an issue with a supported format, what can I do?
You can create an issue with informations.
How to convert audio files?
This package doesn't provide a way to convert audio files, but you can use ffmpeg to convert audio files and PHP-FFMpeg/PHP-FFMpeg.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
ewilan-riviere
: package authorJamesHeinrich/getID3
: parser used to read audio filesspatie/package-skeleton-php
: package skeleton used to create this package
License
The MIT License (MIT). Please see License File for more information.