PHPackages                             p-chess/chess - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. p-chess/chess

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

p-chess/chess
=============

A PHP chess library that is used for chess move generation/validation, piece placement/movement, and check/checkmate/stalemate detection

v1.1.0(3mo ago)473.3k↓22.2%61MITPHPPHP ^8.1CI passing

Since Apr 12Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/p-chess/chess)[ Packagist](https://packagist.org/packages/p-chess/chess)[ RSS](/packages/p-chess-chess/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (11)Used By (1)

Chess
=====

[](#chess)

Chess is a PHP chess library used for chess move generation/validation, piece placement/movement, and check/checkmate/stalemate detection - basically everything but the AI.

NOTE: this started as a port of [chess.js](https://github.com/jhlywa/chess.js) for PHP, forked from [ryanhs/chess.php](https://github.com/ryanhs/chess.php)

[![Latest Stable Version](https://camo.githubusercontent.com/09c20262e1292d46bf6478568c204a3acdbd669c28aabad9219f84d7e0c6d91c/68747470733a2f2f706f7365722e707567782e6f72672f702d63686573732f63686573732f762f737461626c65)](https://packagist.org/packages/p-chess/chess)[![MIT License](https://camo.githubusercontent.com/9d820c84321d5dad80dc4f0285fbd2e9ec5f582e16b2345947b8c743d1e29b9f/68747470733a2f2f706f7365722e707567782e6f72672f702d63686573732f63686573732f6c6963656e7365)](LICENSE.md)
[![Build Status](https://github.com/p-chess/chess/workflows/run-tests/badge.svg)](https://github.com/p-chess/chess/actions)

Installation
------------

[](#installation)

use composer with `composer require p-chess/chess`or put in your composer.json

```
"require": {
    "p-chess/chess": "^1.0"
}

```

Example Code
------------

[](#example-code)

The code below plays a complete game of chess... randomly.

```
