Download the PHP package bridgemate/dataconnector-client without Composer
On this page you can find all versions of the php package bridgemate/dataconnector-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bridgemate/dataconnector-client
More information about bridgemate/dataconnector-client
Files in bridgemate/dataconnector-client
Package dataconnector-client
Short Description Scoring program client for the Bridgemate Data Connector over http. Communicate with Bridgemate Control Software (BCS 5) from a bridge scoring program written in PHP.
License LGPL-3.0-only
Homepage https://github.com/BridgeSystems/Bridgemate-Data-Connector-Scoring-Program-Client-PHP
Informations about the package dataconnector-client
Bridgemate Data Connector scoring program client for PHP
PHP client for scoring programs to communicate with the Bridgemate Data Connector over http. Bridgemate Control Software (BCS 5) is needed to receive, process and return data from the Data Connector. This package is the PHP counterpart of the .NET client; its wire format is generated from the .NET source and verified against golden fixtures, so the two clients speak an identical protocol.
Requirements
- PHP 8.1 or later with
ext-curlandext-json - A reachable Bridgemate Data Connector (installed with BCS 5). When the scoring program runs on a different computer than BCS, enable listening on the local network in BCS and allow the port (default 5079) through the firewall on the BCS computer.
Installation
Quick start
All methods return a ScoringProgramResponse (poll methods return arrays of DTOs) and never throw
on communication problems: inspect DataType/ErrorType on the response, exactly like with the
.NET client.
Polling model
Http is stateless and the client keeps no connection open, so it fits both a long-running CLI
worker (poll in a loop) and a web application (poll on demand during a request). The id of the
last polled queue item per data type is cached on the client instance and used by
acceptQueueData(); in a web application poll and accept within the same request, or track the
queue item ids yourself via getLastQueueItemId().
Getting started sample
examples/getting-started.php is a small console application that exercises the whole workflow against a live Data Connector — use it as a template for your own scoring program:
Mind that "Initialize event" starts Bridgemate Control Software and creates a small test event (1 section, 2 tables, 3 rounds, 8 players). The poll queues only carry data once BCS produces it: enter a result in BCS (or on a Bridgemate) and then poll for results here. The sample prints every request and response envelope (wire trace, toggleable), which is the fastest way to learn the protocol.
Debugging in Visual Studio Code
Open this folder in VS Code and install the recommended extensions (Intelephense + PHP Debug,
suggested automatically). With PHP and Xdebug installed,
press F5 — launch configurations for the sample and for PHPUnit are provided in
.vscode/launch.json. Set a breakpoint in src/DataConnectorClient.php::sendRequest() to watch
every envelope being built and sent.
Documentation
The protocol, the procedures (initializing an event, updating movements, the queues) and all DTOs
are described in the
Bridgemate Data Connector developer's guide.
The DTO classes in src/Dto carry the same names and property names as the guide.
Validation
Bridgemate\DataConnector\Validation\DtoValidator ports the Validate() methods of the .NET
client, one static method per DTO (DtoValidator::validateInitDTO($dto),
validateResultDTO($dto), ...). Each method fills the DTO's ValidationMessages property and
returns true when the DTO is valid. Validate before you send: client-side validation is
advisory and lets you reject bad data with a precise message before it leaves your program, but
the Data Connector service re-validates authoritatively and returns a response with ErrorType
Validation when it rejects a payload.
Note on explicit seatings: a ParticipationDTO may only carry a RoundNumber above one for a
section that was created with HasExplicitParticipations set — for all other sections BCS
calculates the seating for later rounds from the movement.
The validators are hand-written parity ports of the C# originals: their boolean results and
message texts (including order) are asserted against generated golden fixtures in
tests/fixtures/validation, produced by the .NET client itself.
Scope
This first release covers the core workflow: connect/ping, initialize, continueEvent,
updateMovement, updateScoringGroups, the send* methods (results, player data,
participations, handrecords, TD calls, Bridgemate 2/3 settings), the pollFor* methods and
acceptQueueData. BCS management commands are not wrapped yet; sendRequest() is public for
anything the client does not cover.
Compatibility
| Package version | Data Connector / BCS |
|---|---|
| 1.x | BCS 5.x (Data Connector with http support) |
Development
The src/Dto classes and tests/fixtures are generated from the .NET client repository
(tools/DtoGenerator there) — do not edit them by hand. The fixture tests assert structural JSON
equality with the exact bytes the .NET client produces.
Other platforms and support
The same client exists for .NET (the reference implementation, including the scoring program emulator), Java and Python. Questions are welcome in the Discussions of the main repository; see SUPPORT.md.
License
Copyright © Bridge Systems BV. This library is free software, licensed under the GNU Lesser General Public License v3.0 only (LGPL-3.0-only) — see LICENSE — like the .NET reference client.
All versions of dataconnector-client with dependencies
ext-curl Version *
ext-json Version *