2017 © Pedro Peláez
 

library serial

PHP class utilizing Direct IO to interact with a RS232 serial port

image

mdlayher/serial

PHP class utilizing Direct IO to interact with a RS232 serial port

  • Thursday, March 14, 2013
  • by mdlayher
  • Repository
  • 5 Watchers
  • 9 Stars
  • 69 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

serial

PHP class utilizing Direct IO to interact with a RS232 serial port., (*1)

Installation

To install using Composer, add "mdlayher/serial": "dev-master" to the require section of your composer.json., (*2)

Usage

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());

The Versions

14/03 2013

dev-master

9999999-dev https://github.com/mdlayher/serial

PHP class utilizing Direct IO to interact with a RS232 serial port

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-dio *

 

serial rs232 dio