Download the PHP package p-chess/chess without Composer

On this page you can find all versions of the php package p-chess/chess. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package chess

Chess

Chess is a PHP chess library that is 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 for php, forked from ryanhs/chess.php

Latest Stable Version MIT License

Installation

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

Example Code

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

Supported output formats

ASCII

Pieces are displayed with corresponding codes (e.g. "p" for pawn, "q" for queen, etc.).

Unicode

Pieces are displayed like in the example above.

PNG Image

Pieces are displayed inside a png image.

See dedicated documentation for a detailed instructions.

HTML

Pieces are displayed inside an HTML table.

See dedicated documentation for a detailed instructions.

Performance

There is still a lot to do in this topic.
akondas/php-grandmaster is a good place to start experiment ;)

Chess::move()

iteration mean comment
1 548.819μs initial
2 447.973μs replace fen with json_encode in history position (inThreefoldRepetition cache)
3 340.375μs replace fen with json_encode in generateMoves
4 333.145μs add boardHash calculation on make/undo move
5 25.917μs :fire: add cache for moveToSAN method

Other documentation

All classes are documented in the docs directory.


All versions of chess with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ext-ctype Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package p-chess/chess contains the following files

Loading the files please wait ....