PHP code example of dominikveils / pgn-parser
1. Go to this page and download the library: Download dominikveils/pgn-parser library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
dominikveils / pgn-parser example snippets
ser = new DominikVeils\PGNParser\PGNParser;
$pgn = "... pgn string";
$games = $parser->fromString($pgn);
// Now $games is array of DominikVeils\PGNParser\Game objects
foreach ($games as $game) {
// Do your staff here
// Each game could be converted into a JSON string or just an array
$game_json = $game->toJSON();
$game_array = $game->toArray();
}