A growing collection of opinionated, runnable examples showing how to use
php-opcua/opcua-client for
real-world tasks — and, just as importantly, how to avoid the mistakes
that bite hardest in production.
Each example is self-contained: clone, composer install, run. The point
is not to demo a single API call; the point is to deliver an end-to-end
shape that already takes care of the things people forget on the first
try (reconnection, graceful shutdown, error classification, listener
isolation, observability hooks).
| Path | Topic | Mitigates |
|---|---|---|
iot-data-collection/only-core |
Long-running daemon (subscriptions) + cron one-shot (readMulti) sharing the same PSR-14 event bus |
Session loss, blocking listeners, alarm storms, OOM spirals, silent stalls, restart races |
More examples land under their own subdirectories as the use cases
solidify. The current naming scheme is <category>/<variant> —
<variant> denotes which dependencies and assumptions an example takes
on (e.g. only-core = pure opcua-client, no session manager, no
framework).
Every example in this folder follows the same three rules.
1. Be opinionated. OPC UA is a flexible spec; the examples take clear positions (subscribe-don't-poll for live data, separate collection from storage, push slow work onto a queue, supervisor that never gives up, etc.). The README of each example explains why — so you can disagree on purpose, not by accident.
2. Mitigate the common mistakes by default. PHP and OPC UA each have failure modes that bite first-time users. The scaffolds wire in the defenses up front, so you start one step ahead and only loosen constraints with intention.
cd <category>/<variant>
composer install
# follow the example-specific README for the entry-point commandMost examples accept OPCUA_ENDPOINT and LOG_LEVEL env vars to
override the default endpoint and verbosity without editing files.
php-opcua/opcua-client— the pure-PHP OPC UA client every example depends onphp-opcua/opcua-cli— CLI tool to browse, read, write, watch, manage trusted certs, generate code from NodeSet2.xmlphp-opcua/opcua-session-manager— daemon-based session persistence across PHP requests (used by examples that want to share a session between web workers and background workers)php-opcua/opcua-client-nodeset— pre-generated PHP types from 51 OPC Foundation companion specs (DI, Robotics, Machinery, ISA-95, MTConnect, …)php-opcua/laravel-opcua— Laravel integration
Each example carries its own LICENSE file. Unless stated otherwise,
all examples are MIT-licensed.