fabrn/ydk-file-reader
最新稳定版本:1.0.0
Composer 安装命令:
composer require fabrn/ydk-file-reader
包简介
Simple PHP library for YDK file reading
README 文档
README
Simple PHP library that make .ydk file reading easier.
Install using Composer
composer require fabrn/ydkfilereader
Usage
In order to parse a specific YDK file, the Ydk::readFile will do the job :
$ydk = Ydk::readFile('my_file.ydk');
Once you've done that, you get an Ydk instance that contains everything you need
to read the parsed file using public properties :
- author : if mentioned, the author can be retrieved
- mainDeck : list of card IDs of the main deck
- extraDeck : list of card IDs of the extra deck
- sideDeck : list of card IDs of the side deck
Using a custom parser
If, for some reason, you need to use a custom YDK parser, you can create one :
class MyYdkParser implements YdkParserInterface { public function parse(string $ydk): array { // TODO : parse YDK content } }
Then use the parser by giving it as a second argument to the readFile method :
$ydk = Ydk::readFile('my_file.ydk', new MyYdkParser());
Directly parse YDK content
The Ydk class' constructor takes some raw YDK content to parse. The readFile is
useful to get a file's content and construct the Ydk instance with it. But, if you
need to, you can give it yourself :
$ydk = new Ydk($ydkContent);
Note that you can also use a custom parser using the constructor :
$ydk = new Ydk($ydkContent, new MyYdkParser());
License and legal notice
This package is available under MIT license.
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-12-21