icemad / ptcgl-decklist-parser
Library to parse decklist from Pokemon TCG Live
1.1.0
2025-02-09 21:56 UTC
Requires
- php: >=8.4
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^11.5
- rregeer/phpunit-coverage-check: ^0.3.1
README
A parser for Pokemon TCG Live decklist
Features
- Decklist Parsing: Convert PTCGL decklist string into structured data for analysis or transformation.
- Decklist Formatting: Convert back structured data to decklist string.
Installation
To include this parser in your project, you can install it via Composer:
composer require icemad/ptcgl-decklist-parser
Usage
Parsing
$parser = new DecklistParser([ new CardLineParser(), new CategoryLineParser(), ]); $result = $parser->parse($deckList) // string containing decklist
The output is an instance of Icemad\PtcglDecklistParser\Model\ParsingResult
.
It the parsing is successful, ParsingResult::getParsingFailures
should return an empty array.
Formatting
$string = new DecklistFormatter()->format($result->getParsedLines());