A PHP library to split PGN files into chunks per game or per section.
Via composer:
composer require chesszebra/pgn-splitter
Split a stream per game:
use ChessZebra\Chess\Pgn\Splitter;
$stream = fopen('my-games.pgn', 'r');
$splitter = new Splitter($stream, Splitter::SPLIT_GAMES);
$splitter->split(function(string $buffer) {
echo $buffer;
});
Or split a stream per chunk (tags and moves chunks):
use ChessZebra\Chess\Pgn\Splitter;
$stream = fopen('my-games.pgn', 'r');
$splitter = new Splitter($stream, Splitter::SPLIT_CHUNKS);
$splitter->split(function(string $buffer) {
echo $buffer;
});
Please see CONTRIBUTING and CONDUCT for details.
If you discover any security related issues, please report them via HackerOne.
The MIT License (MIT). Please see License File for more information.