2017 © Pedro Peláez
 

library serialport

Serial port access convenience class

image

lepiaf/serialport

Serial port access convenience class

  • Monday, July 16, 2018
  • by lepiaf
  • Repository
  • 3 Watchers
  • 3 Stars
  • 350 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 3 Open issues
  • 8 Versions
  • 31 % Grown

The README.md

SerialPort

Connect to serial port with PHP, (*1)

Inspired by PHP-Serial, I simplify it and include composer.json to install via composer., (*2)

Actually, it works on linux. This library is suitable for working with Arduino., (*3)

Install via composer

composer require "lepiaf/serialport"

How to use

You can check a full example in example folder. It contains a basic Arduino sketch and php file to read it., (*4)

Instantiate a new SerialPort object with a parser and configure tty., (*5)

<?php

use lepiaf\SerialPort\SerialPort;
use lepiaf\SerialPort\Parser\SeparatorParser;
use lepiaf\SerialPort\Configure\TTYConfigure;

$serialPort = new SerialPort(new SeparatorParser(), new TTYConfigure());

$serialPort->open("/dev/ttyACM0");
while ($data = $serialPort->read()) {
    echo $data."\n";

    if ($data === "OK") {
        $serialPort->write("1\n");
        $serialPort->close();
    }
}

For mac os, you must use TTYMacConfigure. It will use stty -f instead of stty -F., (*6)

The Versions

16/07 2018

dev-arduino-sketch-example

dev-arduino-sketch-example

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

16/07 2018

dev-master

9999999-dev

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

13/03 2017

v1.0.5

1.0.5.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

03/11 2016

v1.0.4

1.0.4.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

02/11 2016

v1.0.3

1.0.3.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

31/10 2016

v1.0.2

1.0.2.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

31/10 2016

v1.0.1

1.0.1.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon

31/10 2016

v1.0.0

1.0.0.0

Serial port access convenience class

  Sources   Download

MIT

by Thierry Thuon