ratacibernetica / 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-18 18:06:46 UTC
README
此 GetId3 库的分支 仅在 PHP +5.3 下运行。它更新到 PSR-2 / PSR-4 标准,增加了命名空间,并通过 composer 进行安装。
有用链接
许可证
有关许可证信息,请阅读 Resources/doc/license.txt
有关商业许可证,请阅读 Resources/doc/license.commercial.txt
通过 composer 安装
运行 composer 安装库
$ composer require "phansys/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); } }