willwh / getid3
GetId3 库的此分支更新到 PSR-2 / PSR-4 CS,添加命名空间,并使其可以通过 composer 安装。
v2.0.0-BETA1
2012-12-04 17:31 UTC
Suggests
- ext-exif: EXIF extension is required for graphic modules.
- ext-rar: RAR extension is required for RAR archive module.
This package is not auto-updated.
Last update: 2024-09-26 19:34:16 UTC
README
GetId3 库的此分支仅适用于 PHP +5.3。它更新到 PSR-2 / PSR-4 标准,添加命名空间,并使其可以通过 composer 安装。
有用链接
许可协议
有关许可信息,请阅读 Resources/doc/license.txt
有关商业许可,请阅读 Resources/doc/license.commercial.txt
通过 composer 进行安装
运行 composer 以安装库
$ composer require "willwh/getid3: ~2.1"
快速使用示例:读取音频属性
<?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); } }