Skip to content

This library provides support for reading and writing chess boards in the Forsyth-Edwards notation.

License

Notifications You must be signed in to change notification settings

chesszebra/forsyth-edwards-notation

Repository files navigation

forsyth-edwards-notation

Latest Version on Packagist Software License Build Status Total Downloads

This library provides support for reading and writing chess boards in the Forsyth-Edwards notation.

Installation

Via composer

composer require chesszebra/forsyth-edwards-notation

Usage

Parse a FEN

use ChessZebra\ForsythEdwardsNotation\FenNotation;

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

Convert a FEN to a string

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

Validating a FEN

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. 

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.