icemad/ptcgl-decklist-parser

Library to parse decklist from Pokemon TCG Live

1.1.0 2025-02-09 21:56 UTC

This package is auto-updated.

Last update: 2025-06-11 13:16:39 UTC


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());