chesszebra/forsyth-edwards-notation

A PHP library that parses Forsyth-Edwards Notation (FEN) values.

1.2.0 2021-04-01 21:55 UTC

This package is auto-updated.

Last update: 2024-11-29 06:02:15 UTC


README

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.