Skip to content
A PHP library to split PGN files into chunks per game.
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
CONDUCT.md
CONTRIBUTING.md
LICENSE.md
README.md
composer.json
composer.lock
phpunit.xml.dist

README.md

pgn-splitter

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A PHP library to split PGN files into chunks per game or per section.

Installation

Via composer:

composer require chesszebra/pgn-splitter

Usage

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

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please report them via HackerOne.

License

The MIT License (MIT). Please see License File for more information.

You can’t perform that action at this time.