-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
99a6e26
commit 86f5158
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# PHP Chess | ||
|
||
A chess library for PHP offering move validation, common formats, multiple variants, UCI engine support, explanation of chess positions, image recognition and knowledge extraction from games. | ||
|
||
## Installation | ||
|
||
### Requirements | ||
|
||
- PHP >= 8.1 | ||
- Stockfish >= 15.1 | ||
|
||
### Composer installation | ||
|
||
```text | ||
composer require chesslablab/php-chess | ||
``` | ||
|
||
## Features | ||
|
||
### Formats Supported | ||
|
||
- Chess moves in LAN and PGN formats. | ||
- Movetext processing in LAN, SAN and RAV formats. | ||
- NAG support for SAN and RAV movetexts. | ||
- UCI protocol. | ||
- Chess board to PNG and JPG image. | ||
- PNG and JPG image to FEN. | ||
- FEN to chess board. | ||
- Chess board to MP4 video. | ||
|
||
| Acronym | Description | | ||
| :------ | :----------------------------- | | ||
| LAN | Long Algebraic Notation | | ||
| PGN | Portable Game Notation | | ||
| SAN | Standard Algebraic Notation | | ||
| RAV | Recursive Annotation Variation | | ||
| NAG | Numeric Annotation Glyphs | | ||
| UCI | Universal Chess Interface | | ||
| FEN | Forsyth-Edwards Notation | | ||
|
||
### Chess Variants | ||
|
||
Multiple variants are supported with the default one being classical chess. | ||
|
||
| Variant | Chessboard | | ||
| ------- | ---------- | | ||
| Capablanca | [Chess\Variant\Capablanca\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/Capablanca/BoardTest.php) | | ||
| Capablanca-Fischer | [Chess\Variant\CapablancaFischer\Board](https://github.com/chesslablab/php-chess/blob/main/src/Variant/CapablancaFischer/Board.php) | | ||
| Chess960 | [Chess\Variant\Chess960\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/Chess960/BoardTest.php) | | ||
| Classical | [Chess\Variant\Classical\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/Classical/BoardTest.php) | | ||
| Dunsany | [Chess\Variant\Dunsany\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/Dunsany/BoardTest.php) | | ||
| Losing Chess | [Chess\Variant\Losing\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/Losing/BoardTest.php) | | ||
| RacingKings | [Chess\Variant\RacingKings\Board](https://github.com/chesslablab/php-chess/blob/main/tests/unit/Variant/RacingKings/BoardTest.php) | | ||
|
||
### UCI Engines | ||
|
||
Listed below are the UCI engines available at the moment. | ||
|
||
- Stockfish | ||
|
||
### Object-Oriented | ||
|
||
The chess board representation is an object of type [SplObjectStorage](https://www.php.net/manual/en/class.splobjectstorage.php) as opposed to a bitboard. | ||
|
||
### Thoroughly Tested | ||
|
||
PHP Chess has been developed with a test-driven development (TDD) approach. | ||
|
||
The [tests/unit](https://github.com/chesslablab/php-chess/tree/main/tests/unit) folder contains plenty of real examples. Almost every class in the [src](https://github.com/chesslablab/php-chess/tree/main/src) folder represents a concept that is tested accordingly in the [tests/unit](https://github.com/chesslablab/php-chess/tree/main/tests/unit) folder, in other words, the structure of the [tests/unit](https://github.com/chesslablab/php-chess/tree/main/tests/unit) folder is mirroring the structure of the [src](https://github.com/chesslablab/php-chess/tree/main/src) folder. | ||
|
||
The PHP Chess docs are more of a tutorial rather than an API description. The unit tests are the best documentation. For further details on how to use a particular class, please feel free to browse the codebase and check out the corresponding tests. | ||
|
||
### Lightweight | ||
|
||
PHP dependencies required: | ||
|
||
- Rubix ML for machine learning. | ||
- Imagine for image processing. |