Skip to content

0.0.4

Choose a tag to compare

@sfkelseylee sfkelseylee released this 30 Jan 07:54
· 11 commits to main since this release

Version 0.0.4


Two updates have been implemented in this version:

1. Optional WebSocket dependencies

  • Moved react/socket and phrity/websocket to suggest in composer.json
  • Added runtime class existence checks in examples with installation hints

2. Factory methods for raw OCPP arrays

  • Call::fromArray(array $message, string $version) - create typed Call from [2, messageId, action, payload]
  • CallResult::fromArray(array $message, string $action, string $version) - create typed CallResult from [3, messageId, payload]
  • JsonSchemaRegistry::createFromArray() - unified method that handles both
  • Constructors now also accept an optional $payload array

Example usage:

$raw = [2, "msg-001", "BootNotification", ["chargePointVendor" => "X", "chargePointModel" => "Y"]];
$call = Call::fromArray($raw, 'v1.6');
// or
$call = (new JsonSchemaRegistry())->createFromArray($raw, 'v1.6');

Full Changelog: 0.0.3...0.0.4