A chess library for PHP.
Via composer:
$ composer require chesslablab/php-chess
Variants:
Chess\Game::VARIANT_960Chess\Game::VARIANT_CAPABLANCA_80Chess\Game::VARIANT_CAPABLANCA_100Chess\Game::VARIANT_CLASSICAL
Modes:
Chess\Game::MODE_ANALYSISChess\Game::MODE_GMChess\Game::MODE_FENChess\Game::MODE_PGNChess\Game::MODE_PLAYChess\Game::MODE_STOCKFISH
use Chess\Game;
$game = new Game(
Game::VARIANT_CLASSICAL,
Game::MODE_ANALYSIS
);
$game->play('w', 'e4');
$game->play('b', 'e5');$game->play returns true or false depending on whether or not a move can be made in Portable Game Notation (PGN) format. The Universal Chess Interface (UCI) protocol is supported as well as the long algebraic notation.
$game->playLan('w', 'e2e4');
$game->playLan('b', 'e7e5');Read the latest docs here.
Check out this demo.
The GNU General Public License.
See the contributing guidelines.
Happy learning and coding! Thank you, and keep it up.