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.

FAQ

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.
Please rate this library. Is it a good library?

Informations about the package opcua-client

OPC UA PHP Client

Tests Coverage Latest Version PHP Version

Linux macOS Windows

Quality Gate Status Reliability Rating Security Rating Maintainability Rating Coverage Vulnerabilities Code Smells Duplicated Lines (%)


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:

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.

Trust server certificates

Trust on first use (TOFU):

Disable trust validation:

Or manage from the CLI with php-opcua/opcua-cli:

Auto-discover custom types

Extend the client with custom modules

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?

Features

Feature What it does
Browse Navigate the address space — recursive, automatic continuation, tree building
Path Resolution Resolve /Objects/MyPLC/Temperature to a NodeId in one call
Read / Write Single and multi operations, all OPC UA data types, automatic type detection with caching
Server BuildInfo getServerBuildInfo() returns product name, manufacturer, version, build number, and build date in one call
Node Management Add/delete nodes and references at runtime — all 8 node classes, automatic attribute encoding
Method Call Invoke server methods with typed arguments and results
Subscriptions Data change and event monitoring with publish/acknowledge, modify monitored items, conditional triggering
Transfer & Recovery Transfer subscriptions across sessions and republish unacknowledged notifications
History Read Raw, processed (aggregated), and at-time historical queries
Endpoint Discovery Discover available endpoints and security policies
Security 10 policies: 6 RSA (None through Aes256Sha256RsaPss) + 4 ECC (NIST P-256/P-384, Brainpool P-256/P-384)
Authentication Anonymous, Username/Password, X.509 Certificate
Auto-Retry Automatic reconnect on connection failures
Fluent Builder API 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:

Section Covers
Getting started — Thinking in OPC UA Concepts, install, first connection
Connection — Timeouts & retry Connection lifecycle, discovery, retry
Operations — Managing nodes Read/write, browse, subscribe, history, node management
Security — Cache hardening Security policies, certs, trust, cache hardening
Types — Built-in types Type system reference
Extensibility — Wire serialization Modules, codecs, custom types
Observability — Caching Logging, PSR-14 events, caching
Testing — Integration Test fixtures and integration suites
Reference — Enums Public API surface
Recipes — Server capabilities Task-oriented walkthroughs

Testing

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.

Alternatives & Comparison

PHP

Library PHP Dependencies Security Policies History Read Auto-Batching Notes
php-opcua/opcua-client 8.2+ ext-openssl only 10 (6 RSA + 4 ECC) Yes Yes Zero external deps, full binary protocol
techdock/opcua 8.4+ phpseclib, symfony/cache, monolog, ... Basic256Sha256 No Yes Heavier dependency tree, still v0.2
techdock/opcua-webapi-client 8.1+ Guzzle N/A (HTTP) No No Needs an OPC UA WebAPI gateway, not binary protocol
QuickOPC COM Windows + COM Yes Yes N/A Commercial, Windows-only, not a real PHP package

Ecosystem

Package Description
opcua-client Pure PHP OPC UA client (this package)
opcua-cli CLI tool — browse, read, write, watch, discover endpoints, manage certificates, generate code from NodeSet2.xml
opcua-session-manager 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.
opcua-client-nodeset Pre-generated PHP types from 51 OPC Foundation companion specifications (DI, Robotics, Machinery, MachineTool, ISA-95, CNC, MTConnect, and more). 807 PHP files — NodeId constants, enums, typed DTOs, codecs, registrars with automatic dependency resolution. Just composer require and loadGeneratedTypes().
laravel-opcua Laravel integration — service provider, facade, config
uanetstandard-test-suite 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.

Roadmap

See ROADMAP.md for what's coming next.

Contributing

Contributions welcome — see CONTRIBUTING.md.

Changelog

See CHANGELOG.md.

License

MIT


All versions of opcua-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-openssl Version *
psr/log Version ^3.0
psr/simple-cache Version ^3.0
psr/event-dispatcher Version ^1.0
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 ...