biigle / ifdo
用于解析和验证 iFDO JSON Schema 的 iFDO 解析器包
v1.0.0
2024-09-04 11:45 UTC
Requires
- php: ^8.1
- justinrainbow/json-schema: ^5.2
Requires (Dev)
- phpunit/phpunit: ^10.0 || ^11.0
README
一个 PHP 包,用于读取和验证 iFDO v2 文件。
安装
composer require biigle/ifdo
用法
use Biigle\Ifdo\Ifdo; $path = __DIR__ . '/fixtures/ifdo-test-v2.0.0.json'; $obj = Ifdo::fromFile($path); // print errors to console if document is no valid $obj->setDebug(true); // check if document is valid $obj->isValid(); // get list of errors if there are any $obj->getErrors(); // get full json as array $obj->getJsonData(); // shorthands to safely access info $obj->getImageSetHeader(); $obj->getImageSetItems(); // use strict mode trigger exceptions for invalid files $obj = Ifdo::fromString('{"some": "json"}', true); // get json encoded string $obj->toString();
测试
composer test