dev-master
9999999-dev https://github.com/mdlayher/serialPHP class utilizing Direct IO to interact with a RS232 serial port
MIT
The Requires
- php >=5.3.0
- ext-dio *
by Matt Layher
serial rs232 dio
Wallogit.com
2017 © Pedro Peláez
PHP class utilizing Direct IO to interact with a RS232 serial port
PHP class utilizing Direct IO to interact with a RS232 serial port., (*1)
To install using Composer, add "mdlayher/serial": "dev-master" to the require section of your composer.json., (*2)
Point the class to your serial RS232 device file location. Options may be set once a connection is established., (*3)
<?php
// serial demo
require_once __DIR__ . "/vendor/autoload.php";
use \serial\serial as serial;
// Open serial connection
$serial = new serial("/dev/pts/1");
// Set connection options
$options = array(
"baud" => 38400,
"bits" => 8,
"stop" => 1,
"parity" => 0,
);
$serial->set_options($options);
// Write data, read response (in this case, OBD-II)
$serial->write("AT RV\r");
printf("res: %s\n", $serial->read());
PHP class utilizing Direct IO to interact with a RS232 serial port
MIT
serial rs232 dio