PHP code example of chesszebra / forsyth-edwards-notation

1. Go to this page and download the library: Download chesszebra/forsyth-edwards-notation 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/ */

    

chesszebra / forsyth-edwards-notation example snippets


use ChessZebra\ForsythEdwardsNotation\FenNotation;

$notation = new FenNotation('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');

use ChessZebra\ForsythEdwardsNotation\FenNotation;

$notation = new FenNotation('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');

echo $notation->toString(); // or cast it: (string)$notation

use ChessZebra\ForsythEdwardsNotation\Validator;

$validator = new Validator();

$validationResult = $validator->validate('rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1');

// $validationResult is a ValidationResult constant.