Micro-kernel discovery
Composer extra discovers protocol packages and registers them in ProtocolRegistry at boot.
Industrial / PHP + Rust + Go
Install protocol packages on demand while the kernel handles connections, health checks and gateway rules.
The kernel contains no protocol implementations; it provides ProtocolRegistry, ConnectionManager and six core interfaces, while packages are discovered and registered through the extra field.
Connection management offers three strategies; the gateway engine, circuit breaker, four retry policies, Prometheus metrics, PSR-14 events and PSR-3 logging are all handled by the kernel.
A gear sprite wearing a hard hat and trailing a network cable, with chest signal lights that correspond to 39 industrial protocol packages.
Leave the protocols to my gears.Six kernel duties, configured once.
Composer extra discovers protocol packages and registers them in ProtocolRegistry at boot.
Three connection strategies manage device links, with health checks returning state and latency.
Orchestrate cross-protocol read and write rules so business code need not reach every device.
Four retry policies plus a circuit breaker keep a failing device from taking down the chain.
Connection, request and error metrics are exposed for Prometheus to scrape.
Six frameworks plus plain PHP share one Kernel and connection manager.
Beyond PHP, separate Rust and Go implementations cover their own protocol sets.
38 protocols in Rust
Rust micro-kernel and SDK covering 38 protocols, with 45 crates pulled in on demand.
40 protocols in Go
Go micro-kernel and SDK covering 40 protocols, with 14 pure software and 26 hardware SDKs.
Every version maps to real commits, covering bug fixes and added tests.
Release v1.1.4 as the latest version in the 1.1 series.
Add 752 cases and 2,092 assertions and fix 8 protocol bugs.
Review the kernel and 39 protocol packages and fix 31 defects.
Rename packages to erikwang2013/industrial-protocols-* and unify the prefix.
Install the kernel and a protocol package, then read a register.
composer require erikwang2013/industrial-protocols-kernel erikwang2013/industrial-protocols-modbususe Erikwang2013\IndustrialProtocols\Kernel;
use Erikwang2013\IndustrialProtocols\Modbus\ModbusProtocol;
$kernel = new Kernel(['config_path' => __DIR__ . '/industrial-protocols.php']);
$kernel->getProtocolRegistry()->register(new ModbusProtocol());
$kernel->boot();
$conn = $kernel->getConnectionManager()->connect('plc-001');
$result = $conn->read('40001');
echo $result['40001'];cargo add industrial-protocols-kernel industrial-protocols-modbususe industrial_protocols_kernel::*;
use industrial_protocols_modbus::ModbusProtocol;
let mut kernel = Kernel::builder()
.config_from_str(r#"
[devices.plc-001]
protocol = "modbus"
variant = "tcp"
host = "192.168.1.10"
port = 502
unit_id = 1
"#)
.with_protocol(Box::new(ModbusProtocol::tcp()))
.build();
kernel.boot().expect("boot failed");
kernel.shutdown().expect("shutdown failed");go get github.com/erikwang2013/industrial-protocols-go/kernel@v1.1.4
go get github.com/erikwang2013/industrial-protocols-go/protocols/ethernet/modbus@v1.1.4import (
"github.com/erikwang2013/industrial-protocols-go/kernel"
"github.com/erikwang2013/industrial-protocols-go/kernel/transport"
"github.com/erikwang2013/industrial-protocols-go/protocols/ethernet/modbus"
)
tr, _ := transport.DialTCP("192.168.1.10:502")
defer tr.Close()
codec, _ := modbus.NewCodec("tcp")
req := &kernel.Request{Function: "read_holding_registers", Address: "40001", Count: 2}
req.Metadata["unit_id"] = byte(1)
raw, _ := codec.Encode(req)
tr.Write(raw)
buf := make([]byte, 256)
n, _ := tr.Read(buf)
resp, _ := codec.Decode(buf[:n])
_ = respHover and it changes mood.