Download the PHP
package php-opcua/opcua-client without Composer
On this page you can find all versions of the php package
php-opcua/opcua-client. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor php-opcua Package opcua-client Short Description Pure PHP OPC UA client — binary protocol over TCP, 6 security policies, browse/read/write/subscribe/history, zero external dependencies License
MIT Homepage https://github.com/php-opcua/opcua-client
After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.
Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.
In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories.
In this case some credentials are needed to access such packages.
Please use the auth.json textarea to insert credentials, if a package is coming from a private repository.
You can look here for more information.
Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
To use Composer is sometimes complicated. Especially for beginners.
Composer needs much resources. Sometimes they are not available on a simple webspace.
If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Connect your PHP application directly to industrial PLCs, SCADA systems, sensors, historians, and IoT devices using the OPC UA standard — without any C/C++ extensions, HTTP gateways, or middleware in between.
This library implements the full OPC UA binary protocol stack in pure PHP: TCP transport, binary encoding/decoding, secure channel establishment with asymmetric and symmetric encryption, session management, and all the major OPC UA services. Just composer require and you're talking to PLCs from your Laravel app, your Symfony worker, or a plain PHP script.
What you can do with it:
Read and write process variables from any OPC UA-compliant device — temperatures, pressures, motor speeds, setpoints, counters, anything the server exposes
Browse the entire address space to discover what's available, build tree views, or auto-map variables
Subscribe to data changes and events in real time — get notified when a sensor value changes or an alarm fires
Call methods on the server — trigger operations, run diagnostics, execute commands on the PLC
Query historical data — pull raw logs, aggregated trends (min, max, average), or interpolated values at specific timestamps
Secure everything — 10 security policies: 6 RSA (plaintext to AES-256 with RSA-PSS) + 4 ECC (NIST P-256/P-384 and Brainpool P-256/P-384 with ECDSA/ECDH), plus anonymous, username/password, or X.509 certificate authentication *
All of this with zero external dependencies beyond ext-openssl, and full support for PHP 8.2 through 8.5.
Note: OPC UA relies on persistent sessions and long-lived connections. PHP's request/response model means connections are short-lived by default. For use cases like continuous monitoring or subscription polling, pair this with opcua-session-manager to persist sessions across requests — or use it in a long-running worker process.
The session manager is a separate package by design — it runs as a daemon process using ReactPHP and Unix sockets, which would break this library's zero-dependency, cross-platform philosophy if bundled here. See the Ecosystem section for details.
*ECC note: The 4 ECC policies are implemented per OPC UA 1.05 spec but should be considered experimental. No commercial OPC UA server vendor has released devices with ECC endpoints yet — this is an ecosystem-wide gap. ECC support has been developed and tested exclusively against UA-.NETStandard (the OPC Foundation reference implementation). The implementation follows the 1.05.3 specification and is aligned with 1.05.4 regarding ReceiverCertificateThumbprint, HKDF salt encoding, and LegacySequenceNumbers = FALSE for ECC (sequence numbers start at 0 and wrap at UInt32.MaxValue; landed in v4.3.0). One ECC-specific change from 1.05.4 (per-message IV derivation) is not yet implemented — it is coupled to the future AEAD policy variants. See the Security documentation for details.
### Tested against the OPC UA reference implementation
This library is integration-tested against **[UA-.NETStandard](https://github.com/OPCFoundation/UA-.NETStandard)** — the **reference implementation** maintained by the OPC Foundation, the organization that defines the OPC UA specification.
1700+ tests (1440+ unit, 290+ integration) run via [uanetstandard-test-suite](https://github.com/php-opcua/uanetstandard-test-suite) against 8 server instances covering every security policy, authentication method, data type, method call, subscription, event, alarm, and historical read defined by the spec — with 99%+ unit test code coverage. Unit tests run on **Linux, macOS, and Windows** across PHP 8.2–8.5. NodeManagement integration tests run against an additional `open62541` server (UA-.NETStandard does not implement that service set) — see [testing docs](docs/testing/integration.md).
**This library is already used in production with real industrial equipment** in factory automation and process control environments.
Quick Start
That's it. Three lines to build, connect, and read. No config files, no service containers, no XML.
Tip: All client methods accept NodeId strings like 'i=2259', 'ns=2;i=1001', or 'ns=2;s=MyNode' anywhere a NodeId is expected. Invalid strings throw InvalidNodeIdException.
See It in Action
Browse the address space
Read multiple values
Tip: You can also pass an array to readMulti([...]) -- the builder is just a fluent alternative.
Get server info
Resolve a path and read a value
Write to a PLC
Call a method on the server
Subscribe to data changes
Read historical data
Manage nodes at runtime
Supports all 8 node classes. See Node Management documentation for adding references, class-specific attributes, and error handling.
Connect with full security
Tip: Skip setClientCertificate() and a self-signed cert gets auto-generated in memory — perfect for quick tests or servers with auto-accept.
Decode custom structures with codecs
Each client gets its own isolated codec registry — no global state, no cross-contamination.
Test without a real server
MockClient implements OpcUaClientInterface with no TCP connection. Register handlers with onRead(), onWrite(), onBrowse(), onCall(), and onResolveNodeId(). Track calls with getCalls(), getCallsFor($method), callCount($method), and resetCalls(). Works with fluent builders (readMulti(), writeMulti(), etc.).
Add structured logging
Any PSR-3 logger works — Monolog, Laravel's logger, or your own. Without one, logging is silently disabled (NullLogger).
React to events (PSR-14)
47 granular events covering connection, session, subscription, data change, alarms, read/write, browse, cache, and retry. Zero overhead with the default NullEventDispatcher. See Events documentation for the full list.
Monitor alarms in real time
Explore from the terminal
Full security support, JSON output, debug logging, NodeSet2.xml code generation, and more. See php-opcua/opcua-cli for full documentation.
The client ships with 8 built-in modules (ReadWrite, Browse, Subscription, History, NodeManagement, TranslateBrowsePath, ServerInfo, TypeDiscovery). Add your own or swap built-ins with addModule() and replaceModule(). See Modules for details.
Use pre-built OPC UA companion types
Instead of writing codecs by hand or relying on runtime discovery, install opcua-client-nodeset to get pre-generated PHP types for 51 OPC Foundation companion specifications — DI, Robotics, Machinery, MachineTool, ISA-95, CNC, MTConnect, and many more:
Each Registrar automatically loads its NodeSet dependencies. Use only: true to skip dependency loading if you manage them yourself.
Tip: You can also generate types from your own custom NodeSet2.xml files using opcua-cli generate:nodeset.
Why This Library?
Zero runtime dependencies — only ext-openssl. Optional PSR-3 logging, PSR-16 caching, and PSR-14 events via any compatible implementation.
PHP 8.2+ — runs on any modern PHP.
Native binary protocol — speaks OPC UA directly over TCP. No HTTP gateway, no REST bridge, no sidecar.
Full security stack — 10 policies: 6 RSA up to Aes256Sha256RsaPss + 4 ECC (NIST and Brainpool), 3 auth modes, auto-generated certs, persistent certificate trust store with TOFU.
Industrial-ready — server certificate trust management, alarm event deduction, subscription recovery, auto-retry — built for certified industrial deployments.
Chain readMulti(), writeMulti(), createMonitoredItems(), and translateBrowsePaths() calls with a fluent builder
Auto-Batching
Transparent batching for readMulti/writeMulti
ExtensionObject Codecs
Pluggable per-client codec system for custom structures
Auto-Discovery
discoverDataTypes() auto-detects custom structures without manual codecs
Modular Architecture
8 built-in service modules (ReadWrite, Browse, Subscription, History, NodeManagement, TranslateBrowsePath, ServerInfo, TypeDiscovery). Add custom modules with addModule(), swap built-ins with replaceModule()
Wire Serialization
Every core / module DTO implements WireSerializable for safe JSON-based IPC (opcua-session-manager + future transports). Registry-gated __t discriminators enforce an explicit type allowlist at decode time
Client Introspection
hasMethod(), hasModule(), getRegisteredMethods(), getLoadedModules() surface the live method/module set for runtime dispatch decisions (used by ManagedClient::__call() for transparent third-party module access)
MockClient
In-memory test double — register handlers, assert calls, no TCP connection needed
Logging
Optional structured logging via any PSR-3 logger — connect, retry, errors, protocol details
Cache
Browse, resolve, and metadata read results cached (InMemoryCache, 300s TTL). Plug in any PSR-16 driver (FileCache, Laravel, Redis). Metadata cache opt-in via setReadMetadataCache(true). Values are stored through WireCacheCodec (JSON + registry-gated type allowlist — no unserialize()), overridable via setCacheCodec()
Events
47 granular PSR-14 events — connection, session, subscription, data change, alarms, read/write, browse, cache, retry. Zero overhead when unused
Trust Store
Persistent server certificate validation — file-based trust store, 3 policies (fingerprint/expiry/full CA chain), TOFU auto-accept, CLI management
CLI Tool
opcua-cli — browse, read, write, watch, discover endpoints, manage trusted certificates, and generate code from NodeSet2.xml (separate package)
Documentation
Full documentation is available in docs/. Highlights:
1700+ tests with 99%+ code coverage. Unit tests cover encoding, crypto, protocol services, and error paths. Integration tests run against uanetstandard-test-suite — a Docker-based OPC UA environment built on the OPC Foundation's UA-.NETStandard reference implementation, with multiple security configs, custom types, and real-world scenarios.
CI runs on PHP 8.2, 8.3, 8.4, and 8.5 via GitHub Actions, in three phases:
format check and PHPStan in parallel, then unit tests (Linux, macOS,
Windows), then integration tests against the Docker test servers.
Daemon-based session persistence across PHP requests. Keeps OPC UA connections alive between short-lived PHP processes via a ReactPHP daemon and Unix sockets. Separate package by design — see ROADMAP.md for rationale.
Docker-based OPC UA test servers (UA-.NETStandard) for integration testing
Community
Have questions, ideas, or want to share what you've built? Join the GitHub Discussions.
Connected a PLC, SCADA system, or OPC UA server? We're building a community-driven list of tested hardware and software. Share your experience in Tested Hardware & Software — even a one-liner like "Siemens S7-1500, works fine" helps other users know what to expect.
AI-Ready
This package ships with machine-readable documentation designed for AI coding assistants (Claude, Cursor, Copilot, ChatGPT, and others). Feed these files to your AI so it knows how to use the library correctly:
File
Purpose
llms.txt
Compact project summary — architecture, key classes, API signatures, and configuration. Optimized for LLM context windows with minimal token usage.
llms-full.txt
Comprehensive technical reference — every class, method, DTO, encoding detail, security layer, and protocol service. For deep dives and complex questions.
llms-skills.md
Task-oriented recipes — step-by-step instructions for common tasks (connect, read, write, browse, subscribe, security, testing, Laravel integration). Written so an AI can generate correct, production-ready code from a user's intent.
How to use: copy the files you need into your project's AI configuration directory. The files are located in vendor/php-opcua/opcua-client/ after composer install.
Claude Code: reference per-session with --add-file vendor/php-opcua/opcua-client/llms-skills.md
Cursor: copy into your project's rules directory — cp vendor/php-opcua/opcua-client/llms-skills.md .cursor/rules/opcua-client.md
GitHub Copilot: copy or append the content into your project's .github/copilot-instructions.md file (create the file and directory if they don't exist). Copilot reads this file automatically for project-specific context
Other tools: paste the content into your system prompt, project knowledge base, or context configuration
Composer command for our command line client (download client)This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free.Standard composer command
The package php-opcua/opcua-client contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.