A chess library for PHP.
Via composer:
$ composer require chesslablab/php-chess
Variants:
Chess\Game::VARIANT_960
Chess\Game::VARIANT_CLASSICAL
Modes:
Chess\Game::MODE_ANALYSIS
Chess\Game::MODE_GM
Chess\Game::MODE_FEN
Chess\Game::MODE_PGN
Chess\Game::MODE_PLAY
Chess\Game::MODE_STOCKFISH
use Chess\Game;
$game = new Game(
Game::VARIANT_CLASSICAL,
Game::MODE_ANALYSIS
);
$game->play('w', 'e4');
$game->play('b', 'e5');
The call to the $game->play
method returns true
or false
depending on whether or not a chess move can be made.
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.