The industrial
protocol,
in pure PHP.
A complete OPC UA ecosystem for PHP. Connect your applications to the world of industrial automation — no C extensions, no bindings, just PHP.
A few lines,
a real connection.
Connect to an OPC UA server, read variables, write values, and subscribe to real-time notifications.
- Secure connections with X.509 certificates
- Browse the server address space
- Read/Write attributes and variables
- Subscriptions and MonitoredItems
- 10 security policies (RSA + ECC)
- PSR-3 logging and PSR-14 events
<?php
use PhpOpcua\Client\ClientBuilder;
use PhpOpcua\Client\Types\NodeId;
$client = ClientBuilder::create()
->connect('opc.tcp://localhost:4840');
// Read a value
$value = $client->read('ns=2;s=Temperature');
echo "Temperature: {$value->getValue()} C";
// Browse the Objects folder
$refs = $client->browse(NodeId::numeric(0, 85));
foreach ($refs as $ref) {
echo $ref->displayName . "\n";
}
$client->disconnect();
Why PHP
for OPC UA?
The question everyone asks. Here's why it makes sense.
Your stack is already PHP
Your ERP runs Laravel. Your dashboard is Symfony. Your API is PHP. Why add a Python sidecar or a C# microservice just to talk to a PLC? Keep one language, one deploy, one team.
Zero compilation
No C extensions to compile, no FFI bindings to maintain, no version-specific .so files. composer require and you are done. Works on any host that runs PHP 8.2.
Framework-native
First-class Laravel and Symfony packages. Use Eloquent models alongside OPC UA reads. Dispatch Laravel events on data changes. Cache with Redis. Log with Monolog. It all just works.
Battle-tested cryptography
Delegates all crypto to ext-openssl — the same library that secures your HTTPS traffic. 10 security policies including ECC, tested against the OPC Foundation reference implementation.
The foundation
The core libraries that implement the OPC UA binary protocol, session management, and data types.
OPC UA Client
Pure PHP OPC UA binary protocol client. Secure channels, sessions, read/write, browse, subscriptions, and history.
Session Manager
Long-running daemon that keeps OPC UA sessions alive across PHP request cycles with IPC communication.
NodeSet Parser
Parse NodeSet2.xml files to import OPC UA information models and custom data types.
How it
fits together.
A layered ecosystem where each package has a single responsibility.
Your Application │ ├── laravel-opcua or symfony-opcua Framework integration │ │ │ ├── opcua-session-manager Persistent sessions (optional) │ │ │ └── opcua-client Binary protocol, crypto, I/O │ │ │ └── opcua-client-nodeset Type definitions (optional) │ └── opcua-cli Developer tooling
Framework
support
First-class integration packages for the most popular PHP frameworks.
Laravel Integration
Service Provider, Facade, Artisan commands, config publishing, and automatic session management for Laravel.
Symfony Bundle
Full Symfony integration with dependency injection, configuration, console commands, and profiler support.
Industrial data,
Laravel style.
Use the Facade to read OPC UA values like you query a database. Named connections, auto-discovery, event listeners.
- Facade: Opcua::read(), Opcua::browse()
- Named connections like database config
- Artisan commands for CLI access
- Auto-publish: subscriptions as Laravel events
- MockClient for unit testing
<?php
use PhpOpcua\LaravelOpcua\Facades\Opcua;
// Read from the default connection
$temperature = Opcua::read('ns=2;s=Temperature');
$pressure = Opcua::read('ns=2;s=Pressure');
// Switch to a different PLC
$level = Opcua::connection('tank-plc')
->read('ns=2;s=FillLevel');
// Subscribe to changes (auto-publish mode)
// Dispatches OpcUa\Events\DataChanged to Laravel
Opcua::connection('main-plc')
->createSubscription()
->monitor('ns=2;s=Temperature');
Developer
tools
Command-line utilities and desktop applications for exploring servers and managing infrastructure.
CLI
Browse servers, read/write nodes, watch values in real-time, manage trust stores, and generate PHP code from NodeSet2.xml.
OPC UA Client GUI
coming soonNative desktop application built with NativePHP — visual browser, node inspector, and real-time monitoring without writing code.
Tested against
real servers.
Every protocol feature is validated against real OPC UA servers, not mocks.
Test Suite
Docker-based OPC UA test environment using UA-.NETStandard — 8 pre-configured servers covering all security policies and data types.
Industrial-grade
cryptography.
10 security policies covering RSA and ECC, with certificate trust management and TOFU support.
None
Basic128Rsa15
Basic256
Basic256Sha256
Aes128_Sha256_RsaOaep
Aes256_Sha256_RsaPss
ECC_nistP256
ECC_nistP384
ECC_brainpoolP256r1
ECC_brainpoolP384r1
Deprecated — Basic128Rsa15 and Basic256 are deprecated by the OPC Foundation due to known cryptographic weaknesses. Fully functional and supported for backward compatibility with legacy devices.
Candidate — ECC policies are fully implemented and pass integration tests against UA-.NETStandard reference servers. Marked as candidate because the OPC Foundation ECC companion specification is still in release candidate status (Part 14 v1.05). The API is stable and will not change.
All packages
Browse the full php-opcua ecosystem.
Built for
real factories.
php-opcua is used in production environments to bridge the gap between industrial systems and web applications.
Web dashboards
Build real-time monitoring dashboards in Laravel or Symfony. Read PLC values, display charts, trigger alerts — all in the same stack as your existing web app.
SCADA-to-ERP integration
Connect your shop floor to your business logic. Read production counters from OPC UA and write them directly into your PHP-based ERP, MES, or inventory system.
IoT data collection
Use the session manager daemon to keep persistent connections to hundreds of devices. Collect sensor data, store it in your database, and process it with queues.
Automated testing
Validate your OPC UA server implementation with PHP test suites. Use MockClient for unit tests and the Docker test suite for full integration tests in CI/CD.
Ready to get started?
Install the package, follow the guide, and connect PHP to the industrial world.