vkr / getid3
This fork of phansys/GetId3 provides compatibility with PHP 7.0
2.1.3
2017-04-08 13:45 UTC
Requires
- php: ~7.0
Suggests
- ext-exif: EXIF extension is required for graphic modules.
- ext-rar: RAR extension is required for RAR archive module.
This package is auto-updated.
Last update: 2024-10-20 23:12:02 UTC
README
This fork of phansys/GetID3 is needed to provide compatibility with PHP 7. In fact, the library is already compatible with PHP 7.0, so pretty much the only change is updating dependencies in composer.json.
GetId3
This fork of GetId3 library only works in PHP +5.3. It updates to PSR-2 / PSR-4 standards, adds namespaces and makes it installable by composer.
Useful links
License
For license info please read Resources/doc/license.txt
For commercial license read Resources/doc/license.commercial.txt
Installation via composer
Run composer to install the library:
$ composer require "phansys/getid3: ~2.1"
Quick use example reading audio properties
<?php namespace My\Project; use \GetId3\GetId3Core as GetId3; class MyClass { // ... private function myMethod() { $mp3File = '/path/to/my/mp3file.mp3'; $getId3 = new GetId3(); $audio = $getId3 ->setOptionMD5Data(true) ->setOptionMD5DataSource(true) ->setEncoding('UTF-8') ->analyze($mp3File) ; if (isset($audio['error'])) { throw new \RuntimeException(sprintf('Error at reading audio properties from "%s" with GetId3: %s.', $mp3File, $audio['error'])); } $this->setLength(isset($audio['playtime_seconds']) ? $audio['playtime_seconds'] : ''); // var_dump($audio); } }