gravitymedia / metadata
This package is abandoned and no longer maintained.
No replacement package was suggested.
Metadata library for PHP
v0.1.0
2015-02-20 23:22 UTC
Requires
- php: >=5.4
- ext-iconv: *
- james-heinrich/getid3: ~1.9
- symfony/console: ~2.6
- symfony/finder: ~2.6
- symfony/yaml: ~2.6
- zendframework/zend-filter: ~2.3
- zendframework/zend-servicemanager: ~2.3
- zendframework/zend-stdlib: ~2.3
Requires (Dev)
- phpunit/phpunit: ~4.5
- sami/sami: ~3.0
This package is auto-updated.
Last update: 2023-03-27 00:41:30 UTC
README
#Metadata
Metadata library for PHP
##Requirements##
This library has the following requirements:
- PHP 5.4+
##Installation##
Install composer in your project:
$ curl -s https://getcomposer.org/installer | php
Create a composer.json
file in your project root:
{ "require": { "gravitymedia/metadata": "dev-master" } }
Install via composer:
$ php composer.phar install
##Usage##
Currently reading and writing of ID3 (v1 and v2) metadata is supported. The support for more metadata formats will be available soon.
###CLI###
This library contains a useful CLI script. You may export and import the metadata to/from YAML files. More export/import formats will be available soon.
###ID3 v1###
require 'vendor/autoload.php'; use GravityMedia\Metadata\SplFileInfo; // create new metadata aware file info object $file = new SplFileInfo('/path/to/input/file.mp3'); // get ID3 v1 metadata $metadata = $file->getMetadata(); $tag = $metadata->getId3v1Tag(); // dump tag info var_dump($tag); // update ID3 v1 metadata $tag ->setTitle('New title') ->setArtist('An other artist') ->setAlbum('The album title') ->setYear(2014) ->setComment('This tag was written by metadata library') ->setTrack(1) ->save(); // dump updated tag info var_dump($metadata->getId3v1Tag()); // remove ID3 v1 metadata $tag->remove();
###ID3 v2###
require 'vendor/autoload.php'; use GravityMedia\Metadata\SplFileInfo; // create new metadata aware file info object $file = new SplFileInfo('/path/to/input/file.mp3'); // get ID3 v2 metadata $metadata = $file->getMetadata(); $tag = $metadata->getId3v2Tag(); // dump tag info var_dump($tag); // update ID3 v2 metadata $tag ->setTitle('New title') ->setArtist('An other artist') ->setAlbum('The album title') ->setYear(2014) ->setComment('This tag was written by metadata library') ->setTrack(1) ->save(); // dump updated tag info var_dump($metadata->getId3v2Tag()); // remove ID3 v2 metadata $tag->remove();