Download the PHP package cmuset/chess-tools without Composer

On this page you can find all versions of the php package cmuset/chess-tools. 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-tools

ChessTools

A PHP library for parsing and exporting chess notations: PGN, SAN, and FEN.

Table of Contents

  1. Installation
  2. Quick Start
  3. Tools
  4. Model Layer
  5. Enums Reference
  6. Testing & Development

Installation

Requires PHP >= 8.4.


Quick Start


Tools

Parsers — docs/tools/parser.md

Convert strings into model objects.

Class Input Output
PGNParser PGN string Game or Game[]
SANParser SAN string + color Move
FENParser FEN string Position

Exporters — docs/tools/exporter.md

Serialize model objects back to strings.

Class Input Output
GameExporter Game or Variation PGN string
MoveExporter Move SAN string
PositionExporter Position FEN string

MoveApplier — docs/tools/move-applier.md

Applies a Move to a Position, enforcing all chess rules: castling rights, en passant, promotion, counters, and post-move check validation.

Validators — docs/tools/validator.md

Check positions and games for illegal states.

Class Validates
PositionValidator A single Position (kings, check, pawns, en passant)
GameValidator A full Game — replays every move including sub-variations

Resolvers — docs/tools/resolver.md

Derive information absent from raw SAN: source squares, capture flags, and check/checkmate markers.

Class Resolves
MoveResolver A single Move against a Position
VariationResolver All moves in a Variation sequentially
GameResolver The full game main line + result detection

VariationSplitter — docs/tools/splitter.md

Extracts all nested variations into a flat list of independent Variation objects, each prefixed with the moves preceding the divergence.

VariationMerger — docs/tools/merger.md

Merges Variation objects back into a main line, inserting diverging moves as nested sub-variations at the correct branching points.


Model Overview

Class Description Docs
Game Full PGN game: tags, initial position, main line, result →
Position Board state: pieces, side to move, castling rights, en passant, counters →
Variation Ordered collection of MoveNode instances, keyed by "1." / "1..." notation →
MoveNode Node in the move tree: move + move number + comments + NAGs + sub-variations →
Move Parsed SAN move: piece, destination, flags (capture, check, castling, promotion) →
Square A board square: coordinates + optional piece →

Enums Reference

All domain concepts are PHP string-backed enums.

Enum Values Docs
ColorEnum WHITE 'w' · BLACK 'b' →
PieceEnum WHITE_KING 'K' … BLACK_PAWN 'p' (12 cases) →
CoordinatesEnum A1 'a1' … H8 'h8' (64 cases) →
CastlingEnum WHITE_KINGSIDE 'K' · WHITE_QUEENSIDE 'Q' · BLACK_KINGSIDE 'k' · BLACK_QUEENSIDE 'q' →
ResultEnum WHITE_WINS '1-0' · BLACK_WINS '0-1' · DRAW '1/2-1/2' · ONGOING '*' →

Testing & Development

Or with Docker:


MIT License. See LICENSE.


All versions of chess-tools with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
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 cmuset/chess-tools contains the following files

Loading the files please wait ...