vkr / getid3
这个phansys/GetId3的分支提供了与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-09-20 23:03:37 UTC
README
为了提供与PHP 7的兼容性,需要这个phansys/GetID3的分支。实际上,这个库已经与PHP 7.0兼容,所以主要的更改是更新composer.json中的依赖项。
GetId3
这个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); } }