Download the PHP package p-chess/api without Composer
On this page you can find all versions of the php package p-chess/api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Vendor p-chess
Package api
Short Description PHP client for chess-api.com using PSR-18 HTTP Client
License MIT
Package api
Short Description PHP client for chess-api.com using PSR-18 HTTP Client
License MIT
Please rate this library. Is it a good library?
Informations about the package api
Chess API Client
A PHP client for chess-api.com using PSR-18 HTTP Client.
Requirements
- PHP 8.2+
- PSR-18 HTTP Client implementation (e.g. Symfony HttpClient, Guzzle)
- PSR-17 HTTP Factory implementation
Installation
If you want to use Symfony HttpClient:
If you want to use Guzzle:
Usage
Parameters
| Parameter | Type | Description |
|---|---|---|
$fen |
string |
The chess position in FEN notation (includes side to move) |
$allowedMoves |
array |
Optional array of allowed moves in UCI format (e.g., ['e2e4', 'd2d4']) |
Return Value
The method returns a string containing the best move in UCI format (e.g., 'e2e4').
Exceptions
The client throws ChessApiException in the following cases:
- HTTP error (non-2xx status code)
- Invalid API response (missing
movefield) - API error (e.g., invalid FEN)
Example with Symfony HttpClient
Example with Guzzle
Development
Before exdecuting one of the following, you must execute at least once
Running Tests
Coding Standard
Static Analysis
All versions of api with dependencies
PHP Build Version
Package Version
The package p-chess/api contains the following files
Loading the files please wait ...