Who Says PHP Isn't Good Enough for OPC UA?
For years PHP has been locked out of industrial automation. No native OPC UA client, no serious alternative. Then php-opcua arrived — a complete ecosystem that closes the gap once and for all.
Full article excerpt tap to expand
try { if(localStorage) { let currentUser = localStorage.getItem('current_user'); if (currentUser) { currentUser = JSON.parse(currentUser); if (currentUser.id === 130513) { document.getElementById('article-show-container').classList.add('current-user-is-article-author'); } } } } catch (e) { console.error(e); } Gianfrancesco Posted on Apr 28 Who Says PHP Isn't Good Enough for OPC UA? #php #industrialautomation #laravel #opcua "PHP? For OPC UA? Come on." If you've ever tried to connect a PHP application to a PLC, a SCADA system, or any industrial device, you've probably heard that line. Maybe you said it yourself, opening a browser and searching for a library that didn't exist. That time is over. The Historical Gap OPC UA is the standard protocol for industrial automation. Motors, sensors, historians, SCADA systems, PLCs — the entire Industry 4.0 world speaks OPC UA. It's the OPC Foundation standard: battle-tested, secure, feature-rich. It is, essentially, the TCP/IP of the manufacturing industry. And yet, for years, PHP was left out. These were your options: 1. An HTTP-to-OPC-UA gateway Spin up a separate process (Python, Node.js, a C++ binary), expose a REST API, and have PHP act as the HTTP client. Result: a more complex infrastructure, added latency, one more point of failure, and a second language to maintain in parallel. 2. Compiled C/C++ extensions Some PHP libraries wrap C implementations via FFI or native extensions. But compiling .so files for every PHP version, on every server, in every CI pipeline is an operational nightmare. And if your shared host doesn't support that extension? Dead stop. 3. Shell out to other languages Calling a Python or Node.js process from PHP. Fragile. Slow. Hard to debug. And again: two stacks, two teams, two deployments. 4. Commercial Windows-only libraries COM bridges, proprietary solutions, Windows-dependent. Let's not even go there. The practical result? Anyone running an ERP in Laravel, a dashboard in Symfony, or even just a PHP API that needed to read a temperature from a Siemens S7 — had to face this reality: PHP wasn't "industrial enough." Where php-opcua Comes From The project was born out of a real need. Gianfrancesco Aurecchia, its creator and maintainer, had a PHP application for monitoring a production line. He needed to connect it to Siemens PLCs via OPC UA. Every available option was ugly, expensive, or both. Instead of working around the problem, he built the solution. The result — today — is an ecosystem of 7 packages, 147,000 lines of PHP, 2,649 tests, 5,204 assertions, and zero runtime dependencies beyond ext-openssl. An open-source project that implements the full OPC UA binary protocol natively in PHP. The Ecosystem: Package by Package 1. opcua-client — The Core This is the core package. It implements the entire OPC UA binary protocol stack in pure PHP: TCP transport and binary encoding/decoding Secure channel with asymmetric and symmetric encryption Session management All major OPC UA services: browse, read, write, method call, subscriptions, history composer require php-opcua/opcua-client Enter fullscreen mode Exit fullscreen mode use PhpOpcua\Client\ClientBuilder; $client = ClientBuilder::create() ->connect('opc.tcp://192.168.1.100:4840'); $temp = $client->read('ns=2;s=Temperature'); echo $temp->getValue(); // 23.5 Enter fullscreen mode Exit fullscreen mode Three lines. No config files, no XML, no gateway. 10 security policies, from None up to Aes256_Sha256_RsaPss and the new…
This excerpt is published under fair use for community discussion. Read the full article at DEV Community.