Changelog
[v4.4.0] - 2026-06-09
Aligns the package with the v4.4.0 ecosystem release and adopts the transport-extension naming convention.
Changed — Package rename (breaking)
- Renamed
php-opcua/opcua-client-ext-pubsub→php-opcua/opcua-client-ext-transport-pubsub, matching the sibling transport extensionopcua-client-ext-transport-https. - PHP namespace
PhpOpcua\Client\ExtPubSub\*→PhpOpcua\Client\ExtTransportPubSub\*. Update yourusestatements accordingly.
Changed — Core v4.4.0
- Requires
php-opcua/opcua-client^4.4 (was^4.3). DataSetMetaData::fetchFromServer()now uses the new v4.4.0DataValue::getType()/getValue()accessors instead of the now-@deprecatedDataValue::getVariant(). Behaviour is unchanged for valid DataSetMetaData reads.
[v4.3.0] - 2026-04-x
First public release. Ships the OPC UA PubSub Subscriber as an optional
extension of php-opcua/opcua-client.
The core opcua-client is not modified in any way by installing this
package — it only adds the PhpOpcua\Client\ExtTransportPubSub\* namespace.
Added
SubscriberBuilder::create()— fluent entry point. Configuration methods:setLogger(),setEventDispatcher(),onDataSetMessage(),addModule(),setCodec(),useJson(). Terminals:listenUdp()andlistenOn().Subscriber— thin proxy implementingOpcUaSubscriberInterfacewithrun(),poll(int $timeoutMs),stop(),isRunning().PubSubKernel— event loop over N transports, demux on(publisherId, writerGroupId, dataSetWriterId), PSR-14 dispatch, module lifecycle. Sibling ofClientKernelfrom the core, no shared base.PubSubModulebase class plusDataSetReaderModuleconcrete module.- Readonly DTOs:
NetworkMessage,DataSetMessage,DataSetField,FieldMetaData,DataSetMetaData,PublishedDataSet,DataSetReaderConfig,ReaderGroupConfig,PubSubConnectionConfig,UdpOptions,ReceivedPayload, plus theFieldEncodingenum.
Transports
PubSubTransportInterface— stable contract for plugging in custom transports.open(),close(),poll(int $timeoutMs),isOpen(),transportUri().UdpTransport— full UDP implementation usingext-sockets. Unicast plus IPv4 multicast viaMCAST_JOIN_GROUPwith legacyIP_ADD_MEMBERSHIPfallback,SO_REUSEADDR, configurable receive buffer and TTL, non-blocking sockets,socket_selecttimeout.
Encoding
UadpNetworkMessageCodecandUadpDataSetMessageCodec— Part 14 §6.2 binary PubSub encoding. PublisherId (Byte, UInt16, UInt32, UInt64, String), GroupHeader, PayloadHeader with one or more DataSetMessages, optional network-message timestamp.Variant,RawData, andDataValuefield encodings supported. Chunking, promoted fields, and non-DataSet NetworkMessageTypes are rejected with a clear error.JsonNetworkMessageCodecandJsonDataSetMessageCodec— reversible JSON encoding from Part 14 §7.2 (encode + decode).
Security
PubSubSecurityModeenum (None,Sign,SignAndEncrypt).GroupKeyProviderInterfacewith two implementations:StaticGroupKeyProviderfor pre-shared group keys.SksGroupKeyProviderfor live rotation via a classicOpcUaClientInterface. CallsGetSecurityKeys(Part 14 §8.4.2), splits the returned key material per policy layout (PubSub-Aes256-CTR32+32+4,PubSub-Aes128-CTR32+16+4), exposescurrentTokenId()andlifetimeSecondsRemaining().
PubSubSecurityOptions::unwrap()— HMAC-SHA256 verification for Sign mode, HMAC plus AES-256-CBC decryption for SignAndEncrypt. Payloads that fail validation are dropped and surface asSecurityValidationFailedevents.
Metadata
DataSetMetaData::fromArray(),fromJsonFile(),fromXmlString(),fromXmlFile(),fromBinary(),fetchFromServer(). The XML loader accepts both the compact<DataSetMetaData>schema and the OPC UA<DataSetMetaDataType>/<FieldMetaData>naming emitted by tooling.fetchFromServer()reads a Variable value from a connected coreOpcUaClientInterface, honours already-decoded codec results, and falls back to the binary decoder for raw ExtensionObject bodies.
Events (PSR-14)
NetworkMessageReceived,DataSetMessageReceived,DataSetFieldReceived,MessageDecodeError,SecurityValidationFailed,TransportOpened,TransportClosed,TransportError.Kernel\NullPubSubEventDispatcher— zero-overhead fallback when no dispatcher is configured.
Exceptions
UnsupportedTransportException,PubSubDecodeException,InvalidDataSetReaderException,PubSubSecurityException.
Testing
- Unit coverage for codec round-trips (UADP + JSON), UDP loopback
send/receive, kernel demux,
SubscriberBuilderwiring, security unwrap with valid and tampered payloads, metadata loaders (array, JSON, XML, binary, live server viaMockClient), andSksGroupKeyProvider::refresh()againstMockClient. FakeTransportandCollectingDispatcherhelpers undertests/Unit/Kernel/for driving the kernel in isolation.
Requirements
- PHP >= 8.2 (tested on 8.2, 8.3, 8.4, 8.5)
ext-socketsphp-opcua/opcua-client^4.4psr/log^3.0 andpsr/event-dispatcher^1.0 (interface-only)