This version of GetId3 library only works in PHP >= 5.3 and updates to PSR-0 CS and makes it Symfony2 installable by deps or composer mechanisms.
- [Main site] http://www.getid3.org
- [Support] http://support.getid3.org/
For license info please read Resources/doc/license.txt
For commercial license read Resources/doc/license.commercial.txt
(You can choose deps or composer install mechanisms)
Add following lines to your deps
file:
[GetId3]
git=https://github.com/phansys/GetId3.git
target=/phansys/getid3/GetId3
Now, run the vendors script to download the library:
$ php bin/vendors install
Add the GetId3
namespace to your autoloader:
<?php
// app/autoload.php
$loader->registerPrefixes(array(
// ...
'GetId3' => __DIR__.'/../vendor/phansys/getid3/GetId3',
));
[composer] (http://getcomposer.org/)
Add following lines to your composer.json
"require"
definitions:
"phansys/getid3": "v2.0.0.x-dev"
Now, run the composer script to download the library:
$ php composer.phar install
<?php
namespace My\Project;
use \GetId3\GetId3Core as GetId3;
class MyClass
{
// ...
private function MyMethod()
{
$getId3 = new GetId3();
$getId3->option_md5_data = true;
$getId3->option_md5_data_source = true;
$getId3->encoding = 'UTF-8';
$mp3File = '/path/to/my/mp3file.mp3';
$audio = $getId3->analyze($mp3File);
if (isset($audio['error']))
{
throw new \RuntimeException('Error at reading audio properties with GetId3 : ' . $mp3File);
}
$this->setLength(isset($audio['playtime_seconds']) ? $audio['playtime_seconds'] : '');
// var_dump($audio);
}
}