Skip to content

Commit f3a976d

Browse files
committed
[UPD] rel v4.0.0
1 parent bdd66f2 commit f3a976d

63 files changed

Lines changed: 851 additions & 456 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ What actually happened. Include error messages or exceptions if applicable.
2929

3030
- PHP version:
3131
- Library version:
32-
- opcua-php-client version:
32+
- opcua-client version:
3333
- OPC UA server: (e.g., open62541, Prosys, Unified Automation, etc.)
3434
- OS:
3535

.github/ISSUE_TEMPLATE/question.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ What are you trying to achieve? Include relevant code if applicable.
2222

2323
- PHP version:
2424
- Library version:
25-
- opcua-php-client version:
25+
- opcua-client version:
2626
- OPC UA server: (e.g., open62541, Prosys, Unified Automation, etc.)

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
- name: Start OPC UA test servers
3333
id: opcua
34-
uses: GianfriAur/opcua-test-server-suite@v1.1.4
34+
uses: php-opcua/opcua-test-suite@v1.1.5
3535

3636
- name: Run tests
3737
env:

CHANGELOG.md

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,58 @@
11
# Changelog
22

3+
## [4.0.0] - 2026-03-26
4+
5+
### Rebranding
6+
7+
- **Package renamed** from `php-opcua/opcua-client-session-manager` to `php-opcua/opcua-session-manager`.
8+
- **Namespace renamed** from `Gianfriaur\OpcuaSessionManager` to `PhpOpcua\SessionManager`. All classes, tests, and configuration updated accordingly.
9+
- **Dependency renamed** from `gianfriaur/opcua-php-client` to `php-opcua/opcua-client`. Dependency namespace changed from `Gianfriaur\OpcuaPhpClient` to `PhpOpcua\Client`.
10+
- **Repository moved** to [github.com/php-opcua/opcua-session-manager](https://github.com/php-opcua/opcua-session-manager).
11+
- All documentation, URLs, composer.json metadata, and code references updated to reflect the new organization.
12+
13+
### Changed
14+
15+
- **Breaking**: Updated dependency `php-opcua/opcua-client` from `^3.0` to `^4.0`.
16+
- **Breaking**: **ClientBuilder/Client split.** The daemon's `CommandHandler` now uses `ClientBuilder::create()` instead of `new Client()`. All configuration (security, timeout, cache, batching, etc.) is applied to the builder before calling `connect()`, which returns a `Client` instance. This mirrors the upstream v4.0.0 architecture change. No impact on `ManagedClient` consumers — the proxy API remains the same.
17+
- **Breaking**: `write()` type parameter is now nullable (`?BuiltinType $type = null`). When omitted, the daemon's underlying client auto-detects the node's type by reading it first, then caches the result for subsequent writes. Existing code passing an explicit `BuiltinType` continues to work unchanged.
18+
- **Breaking**: `writeMulti()` items can now have a nullable `type` field. When `type` is null or omitted, auto-detection is used per-node.
19+
- `read()` now accepts a third parameter `bool $refresh = false`. When `true`, the daemon bypasses the read metadata cache and forces a server read. Default `false` preserves existing behaviour.
20+
- Method whitelist expanded from 37 to 45 methods to support all new v4.0.0 operations.
21+
- `psr/event-dispatcher` ^1.0 added as dependency (interface-only package, zero runtime code).
22+
23+
### Added
24+
25+
- **`modifyMonitoredItems(int $subscriptionId, array $itemsToModify): MonitoredItemModifyResult[]`** — Change sampling interval, queue size, and other parameters on existing monitored items without recreating them. Proxied to the daemon's underlying `Client`. Returns `MonitoredItemModifyResult[]` with revised parameters.
26+
- **`setTriggering(int $subscriptionId, int $triggeringItemId, array $linksToAdd, array $linksToRemove): SetTriggeringResult`** — Configure a monitored item as a trigger for other items. Linked items are only sampled when the trigger changes. Returns `SetTriggeringResult` with per-link status codes.
27+
- **Trust store support (daemon-side).** Server certificate validation can now be configured through `ManagedClient`:
28+
- `setTrustStorePath(string)` — Set the file-based trust store path. The daemon creates a `FileTrustStore` instance.
29+
- `setTrustPolicy(?TrustPolicy)` — Set the validation level: `Fingerprint`, `FingerprintAndExpiry`, or `Full`. Pass `null` to disable.
30+
- `autoAccept(bool $enabled, bool $force)` — Enable TOFU (Trust On First Use) for unknown server certificates.
31+
- `trustCertificate(string $certDer)` — Manually trust a DER-encoded certificate (proxied to daemon via IPC).
32+
- `untrustCertificate(string $fingerprint)` — Remove a certificate from the trust store (proxied to daemon via IPC).
33+
- `getTrustPolicy(): ?TrustPolicy` — Get the current trust policy.
34+
- `getTrustStore(): ?TrustStoreInterface` — Returns `null` on `ManagedClient` (trust store lives daemon-side).
35+
- **Write type auto-detection forwarding.** `setAutoDetectWriteType(bool)` on `ManagedClient` configures whether the daemon's `Client` auto-detects write types. Enabled by default.
36+
- **Read metadata cache forwarding.** `setReadMetadataCache(bool)` on `ManagedClient` enables caching of non-Value attributes (DisplayName, BrowseName, DataType, etc.) on the daemon's `Client`.
37+
- **PSR-14 Event Dispatcher interface compliance.** `ManagedClient` now exposes `setEventDispatcher(EventDispatcherInterface)` and `getEventDispatcher()`. Events are dispatched locally on the `ManagedClient` side (daemon-side events are handled by the daemon's own dispatcher). Default: `NullEventDispatcher`.
38+
- `TypeSerializer` now serializes/deserializes `MonitoredItemModifyResult`, `SetTriggeringResult`, and `ExtensionObject` DTOs.
39+
- `TypeSerializer::deserializeBuiltinType()` now accepts `?int` and returns `?BuiltinType` for nullable write type support.
40+
- `TypeSerializer` handles `ExtensionObject` values inside `Variant` deserialization.
41+
- New IPC config keys in the `open` command: `trustStorePath`, `trustPolicy`, `autoAccept`, `autoAcceptForce`, `autoDetectWriteType`, `readMetadataCache`.
42+
- `CommandHandler` now configures `ClientBuilder` with trust store, trust policy, auto-accept, auto-detect write type, and read metadata cache settings from the IPC `open` command.
43+
44+
### Breaking Changes
45+
46+
- Package name changed: `composer require php-opcua/opcua-session-manager` (was `php-opcua/opcua-client-session-manager`).
47+
- Namespace changed: `PhpOpcua\SessionManager\` (was `Gianfriaur\OpcuaSessionManager\`).
48+
- `write()` signature changed from `write(NodeId|string, mixed, BuiltinType)` to `write(NodeId|string, mixed, ?BuiltinType = null)`. The third parameter is now optional.
49+
- Dependency `php-opcua/opcua-client` ^4.0 required (was `php-opcua/opcua-client` ^3.0).
50+
351
## [3.0.0] - 2026-03-23
452

553
### Changed
654

7-
- **Breaking**: Updated dependency `gianfriaur/opcua-php-client` from `^2.0` to `^3.0`.
55+
- **Breaking**: Updated dependency `php-opcua/opcua-client` from `^2.0` to `^3.0`.
856
- **Breaking**: `nodeClassMask` parameter replaced with `nodeClasses` array. Browse methods (`browse()`, `browseWithContinuation()`, `browseAll()`, `browseRecursive()`) now accept `NodeClass[] $nodeClasses = []` instead of `int $nodeClassMask = 0`. Pass an array of `NodeClass` enum values (e.g. `[NodeClass::Object, NodeClass::Variable]`) instead of a raw bitmask integer. Empty array means all classes (same as the old `0`).
957
- **Breaking**: Strict return types for all service responses. The following methods now return typed DTOs instead of associative arrays:
1058
- `createSubscription()``SubscriptionResult` (`->subscriptionId`, `->revisedPublishingInterval`, `->revisedLifetimeCount`, `->revisedMaxKeepAliveCount`)
@@ -15,7 +63,7 @@
1563
- `publish()``PublishResult` (`->subscriptionId`, `->sequenceNumber`, `->moreNotifications`, `->notifications`, `->availableSequenceNumbers`)
1664
- `translateBrowsePaths()``BrowsePathResult[]` (`->statusCode`, `->targets`) with `BrowsePathTarget` (`->targetId`, `->remainingPathIndex`)
1765
- **Breaking**: Ambiguous `$items` parameters renamed for named parameter clarity: `readMulti($readItems)`, `writeMulti($writeItems)`, `createMonitoredItems($subscriptionId, $monitoredItems)`. Only affects code using named parameters.
18-
- All `TypeSerializer` getters updated to use `public readonly` properties from `opcua-php-client` v3.0.0 (`$ref->nodeId` instead of `$ref->getNodeId()`, etc.).
66+
- All `TypeSerializer` getters updated to use `public readonly` properties from `opcua-client` v3.0.0 (`$ref->nodeId` instead of `$ref->getNodeId()`, etc.).
1967
- `TypeSerializer` now preserves `Variant` multi-dimensional array dimensions through serialization/deserialization roundtrips.
2068
- Method whitelist expanded from 32 to 37 methods to support all new v3.0.0 operations.
2169

@@ -55,7 +103,7 @@
55103

56104
### Changed
57105

58-
- **Breaking**: Updated dependency `gianfriaur/opcua-php-client` from `^1.1` to `^2.0`.
106+
- **Breaking**: Updated dependency `php-opcua/opcua-client` from `^1.1` to `^2.0`.
59107
- **Breaking**: `browse()` and `browseWithContinuation()` `$direction` parameter changed from `int` to `BrowseDirection` enum. Replace raw integers (`0`, `1`) with `BrowseDirection::Forward`, `BrowseDirection::Inverse`, or `BrowseDirection::Both`.
60108
- Updated CI test server suite from `opcua-test-server-suite@v1.1.2` to `@v1.1.4`.
61109
- Method whitelist expanded from 18 to 32 methods to support all new v2.0.0 operations.
@@ -81,9 +129,9 @@
81129

82130
### Changed
83131

84-
- Updated dependency `gianfriaur/opcua-php-client` from `^1.0` to `^1.1`, requiring the new auto-generated certificate feature introduced in that release.
132+
- Updated dependency `php-opcua/opcua-client` from `^1.0` to `^1.1`, requiring the new auto-generated certificate feature introduced in that release.
85133

86134
### Added
87135

88-
- **Auto-generated client certificate support.** When a secure connection is opened through the daemon with `SecurityPolicy` and `SecurityMode` configured but no `clientCertPath`/`clientKeyPath` provided, the underlying `Client` automatically generates an in-memory self-signed certificate. The behaviour is transparent and inherited from `opcua-php-client` v1.1 — no changes required in `ManagedClient` or `CommandHandler`.
136+
- **Auto-generated client certificate support.** When a secure connection is opened through the daemon with `SecurityPolicy` and `SecurityMode` configured but no `clientCertPath`/`clientKeyPath` provided, the underlying `Client` automatically generates an in-memory self-signed certificate. The behaviour is transparent and inherited from `opcua-client` v1.1 — no changes required in `ManagedClient` or `CommandHandler`.
89137
- Unit and integration tests for the auto-generated certificate flow.

CONTRIBUTING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to OPC UA PHP Client Session Manager
1+
# Contributing to OPC UA Session Manager
22

33
## Welcome!
44

@@ -13,13 +13,13 @@ If you have any questions or need help getting started, don't hesitate to open a
1313
- PHP >= 8.2
1414
- `ext-openssl`
1515
- Composer
16-
- [opcua-test-server-suite](https://github.com/GianfriAur/opcua-test-server-suite) (for integration tests)
16+
- [opcua-test-server-suite](https://github.com/php-opcua/opcua-test-server-suite) (for integration tests)
1717

1818
### Installation
1919

2020
```bash
21-
git clone https://github.com/gianfriaur/opcua-php-client-session-manager.git
22-
cd opcua-php-client-session-manager
21+
git clone https://github.com/php-opcua/opcua-session-manager.git
22+
cd opcua-session-manager
2323
composer install
2424
```
2525

@@ -28,7 +28,7 @@ composer install
2828
Integration tests require the OPC UA test server suite running locally:
2929

3030
```bash
31-
git clone https://github.com/GianfriAur/opcua-test-server-suite.git
31+
git clone https://github.com/php-opcua/opcua-test-server-suite.git
3232
cd opcua-test-server-suite
3333
docker compose up -d
3434
```
@@ -89,7 +89,7 @@ tests/
8989

9090
### Transparent IPC Proxy
9191

92-
`ManagedClient` implements `OpcUaClientInterface` from `gianfriaur/opcua-php-client` and proxies every call to the daemon over a Unix socket. The goal is a drop-in replacement: any code using `Client` should work with `ManagedClient` without changes.
92+
`ManagedClient` implements `OpcUaClientInterface` from `php-opcua/opcua-client` and proxies every call to the daemon over a Unix socket. The goal is a drop-in replacement: any code using `Client` should work with `ManagedClient` without changes.
9393

9494
### Security by Default
9595

@@ -101,7 +101,7 @@ The daemon (ReactPHP event loop) keeps OPC UA sessions alive in memory across PH
101101

102102
### Public Readonly DTOs
103103

104-
All service response types use `public readonly` properties matching `opcua-php-client` v3.0.0. `TypeSerializer` handles bidirectional conversion between these DTOs and JSON-safe arrays for IPC transport.
104+
All service response types use `public readonly` properties matching `opcua-client` v4.0.0. `TypeSerializer` handles bidirectional conversion between these DTOs and JSON-safe arrays for IPC transport.
105105

106106
## Guidelines
107107

@@ -131,7 +131,7 @@ All service response types use `public readonly` properties matching `opcua-php-
131131

132132
### TypeSerializer Changes
133133

134-
- New DTO types from `opcua-php-client` must have both `serialize*()` and `deserialize*()` methods
134+
- New DTO types from `opcua-client` must have both `serialize*()` and `deserialize*()` methods
135135
- Use public readonly properties, not deprecated getters
136136
- The generic `serialize()` method must handle the new type via `instanceof`
137137

@@ -168,4 +168,4 @@ All service response types use `public readonly` properties matching `opcua-php-
168168

169169
## Reporting Issues
170170

171-
Use the [issue tracker](https://github.com/gianfriaur/opcua-php-client-session-manager/issues) to report bugs, request features, or ask questions.
171+
Use the [issue tracker](https://github.com/php-opcua/opcua-session-manager/issues) to report bugs, request features, or ask questions.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2026 Gianfrancesco
3+
Copyright (c) 2026 Gianfrancesco (php-opcua)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
</div>
1010

1111
<p align="center">
12-
<a href="https://github.com/GianfriAur/opcua-php-client-session-manager/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/GianfriAur/opcua-php-client-session-manager/tests.yml?branch=master&label=tests&style=flat-square" alt="Tests"></a>
13-
<a href="https://codecov.io/gh/GianfriAur/opcua-php-client-session-manager"><img src="https://img.shields.io/codecov/c/github/GianfriAur/opcua-php-client-session-manager?style=flat-square&logo=codecov" alt="Coverage"></a>
14-
<a href="https://packagist.org/packages/gianfriaur/opcua-php-client-session-manager"><img src="https://img.shields.io/packagist/v/gianfriaur/opcua-php-client-session-manager?style=flat-square&label=packagist" alt="Latest Version"></a>
15-
<a href="https://packagist.org/packages/gianfriaur/opcua-php-client-session-manager"><img src="https://img.shields.io/packagist/php-v/gianfriaur/opcua-php-client-session-manager?style=flat-square" alt="PHP Version"></a>
16-
<a href="LICENSE"><img src="https://img.shields.io/github/license/GianfriAur/opcua-php-client-session-manager?style=flat-square" alt="License"></a>
12+
<a href="https://github.com/php-opcua/opcua-session-manager/actions/workflows/tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/php-opcua/opcua-session-manager/tests.yml?branch=master&label=tests&style=flat-square" alt="Tests"></a>
13+
<a href="https://codecov.io/gh/php-opcua/opcua-session-manager"><img src="https://img.shields.io/codecov/c/github/php-opcua/opcua-session-manager?style=flat-square&logo=codecov" alt="Coverage"></a>
14+
<a href="https://packagist.org/packages/php-opcua/opcua-session-manager"><img src="https://img.shields.io/packagist/v/php-opcua/opcua-session-manager?style=flat-square&label=packagist" alt="Latest Version"></a>
15+
<a href="https://packagist.org/packages/php-opcua/opcua-session-manager"><img src="https://img.shields.io/packagist/php-v/php-opcua/opcua-session-manager?style=flat-square" alt="PHP Version"></a>
16+
<a href="LICENSE"><img src="https://img.shields.io/github/license/php-opcua/opcua-session-manager?style=flat-square" alt="License"></a>
1717
</p>
1818

1919
---
2020

21-
Keep OPC UA sessions alive across PHP requests. A daemon-based session manager for [`opcua-php-client`](https://github.com/GianfriAur/opcua-php-client) that eliminates the 50–200ms connection handshake overhead on every HTTP request.
21+
Keep OPC UA sessions alive across PHP requests. A daemon-based session manager for [`opcua-client`](https://github.com/php-opcua/opcua-client) that eliminates the 50–200ms connection handshake overhead on every HTTP request.
2222

2323
PHP's request/response model destroys all state — including network connections — at the end of every request. OPC UA requires a 5-step handshake (TCP → Hello/Ack → OpenSecureChannel → CreateSession → ActivateSession) that must be repeated every single time. This package solves the problem with a long-running [ReactPHP](https://reactphp.org/) daemon that holds sessions in memory, communicating with PHP applications via a lightweight Unix socket IPC protocol.
2424

@@ -36,7 +36,7 @@ PHP's request/response model destroys all state — including network connection
3636
## Quick Start
3737

3838
```bash
39-
composer require gianfriaur/opcua-php-client-session-manager
39+
composer require php-opcua/opcua-session-manager
4040
```
4141

4242
### 1. Start the daemon
@@ -48,7 +48,7 @@ php bin/opcua-session-manager
4848
### 2. Use ManagedClient in your PHP code
4949

5050
```php
51-
use Gianfriaur\OpcuaSessionManager\Client\ManagedClient;
51+
use PhpOpcua\SessionManager\Client\ManagedClient;
5252

5353
$client = new ManagedClient();
5454
$client->connect('opc.tcp://localhost:4840');
@@ -102,8 +102,11 @@ $results = $client->readMulti()
102102
### Write to a PLC
103103

104104
```php
105-
use Gianfriaur\OpcuaPhpClient\Types\BuiltinType;
105+
// Auto-detection (v4) — type inferred automatically
106+
$client->write('ns=2;i=1001', 42);
106107

108+
// Explicit type (still supported)
109+
use PhpOpcua\Client\Types\BuiltinType;
107110
$client->write('ns=2;i=1001', 42, BuiltinType::Int32);
108111
```
109112

@@ -125,8 +128,8 @@ foreach ($response->notifications as $notif) {
125128
### Secure connection with authentication
126129

127130
```php
128-
use Gianfriaur\OpcuaPhpClient\Security\SecurityPolicy;
129-
use Gianfriaur\OpcuaPhpClient\Security\SecurityMode;
131+
use PhpOpcua\Client\Security\SecurityPolicy;
132+
use PhpOpcua\Client\Security\SecurityMode;
130133

131134
$client = new ManagedClient(
132135
socketPath: '/var/run/opcua-session-manager.sock',
@@ -272,18 +275,18 @@ OPCUA_AUTH_TOKEN=$(cat /etc/opcua/daemon.token) php bin/opcua-session-manager \
272275
./vendor/bin/pest tests/Integration/ --group=integration # integration only
273276
```
274277

275-
340+ tests (unit + integration) covering browse, read/write, subscriptions, method calls, path resolution, connection state, security, type serialization, session persistence, session recovery, and all v3.0.0 DTOs.
278+
340+ tests (unit + integration) covering browse, read/write, subscriptions, method calls, path resolution, connection state, security, type serialization, session persistence, session recovery, and all v4.0.0 DTOs.
276279

277280
> **Note on coverage:** `SessionManagerDaemon` is excluded from coverage reports because it runs as a separate long-lived process (ReactPHP event loop). PHP coverage tools (pcov, xdebug) only instrument the test runner process — they cannot track code executing inside a subprocess started via `proc_open()`. The daemon is fully tested by the integration suite, which starts a real daemon, sends IPC commands, and verifies responses. This is a known limitation shared by other daemon-based PHP packages (Laravel Horizon, Symfony Messenger, RoadRunner workers).
278281
279282
## Ecosystem
280283

281284
| Package | Description |
282285
|---------|-------------|
283-
| [opcua-php-client](https://github.com/GianfriAur/opcua-php-client) | Pure PHP OPC UA client — the core protocol implementation |
284-
| [opcua-php-client-session-manager](https://github.com/GianfriAur/opcua-php-client-session-manager) | Session persistence daemon (this package) |
285-
| [opcua-laravel-client](https://github.com/GianfriAur/opcua-laravel-client) | Laravel integration — service provider, facade, config |
286-
| [opcua-test-server-suite](https://github.com/GianfriAur/opcua-test-server-suite) | Docker-based OPC UA test servers for integration testing |
286+
| [opcua-client](https://github.com/php-opcua/opcua-client) | Pure PHP OPC UA client — the core protocol implementation |
287+
| [opcua-session-manager](https://github.com/php-opcua/opcua-session-manager) | Session persistence daemon (this package) |
288+
| [opcua-laravel-client](https://github.com/php-opcua/opcua-laravel-client) | Laravel integration — service provider, facade, config |
289+
| [opcua-test-server-suite](https://github.com/php-opcua/opcua-test-server-suite) | Docker-based OPC UA test servers for integration testing |
287290

288291
## Roadmap
289292

0 commit comments

Comments
 (0)