Download the PHP package gregorj/serial-port without Composer
On this page you can find all versions of the php package gregorj/serial-port. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gregorj/serial-port
More information about gregorj/serial-port
Files in gregorj/serial-port
Package serial-port
Short Description PHP interfaces and classes for serial port communication.
License MIT
Informations about the package serial-port
SerialPort
PHP classes to connect to serial devices using streams or HTTP(S) gateways.
This library separates the command model from the transport:
Commanddefines command payload, terminators, timeout, and response mappingCommunicationexecutes the command (StreamCommunicationorHttpCommunication) viaquery()orwrite()- transport is provided by either
Stream(for sockets) orHttpTransport(for gateways)
BasicStringCommand, BasicVoidCommand, and StringResponse are reference implementations for common command/response patterns.
Usage
You can either:
- bridge a serial device to TCP (for example with pySerial
tcp_serial_redirect) and useTcpStream - call an HTTP(S) serial gateway and use
HttpCommunicationwithCurlTransportorStreamWrapperTransport
TCP stream communication
HTTP gateway communication
HttpCommunication::setTimeout() configures the serial-device response timeout and sends it to the gateway as deviceTimeoutMs.
HTTP transport timeouts (connect and request) are configured separately in CurlTransport and StreamWrapperTransport.
Fire-and-forget commands
If your command does not expect a response, call Communication::write() directly (or use BasicVoidCommand, which now delegates to write()):
For custom command types, implement GregorJ\SerialPort\Interfaces\Command and decide per command whether to call query() or write().
For the expected HTTP JSON contract and fields, see src/Http/JsonSerialGatewayContract.php.
All versions of serial-port with dependencies
ext-curl Version *
ext-sockets Version *
gregorj/to-string Version ^1.0
psr/container Version ^2.0