1. Go to this page and download the library: Download tomio2480/php-serial library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use PhpSerial\Configuration;
// パリティなし
$config = new Configuration(parity: Configuration::PARITY_NONE);
// 奇数パリティ
$config = new Configuration(parity: Configuration::PARITY_ODD);
// 偶数パリティ
$config = new Configuration(parity: Configuration::PARITY_EVEN);
$config = new Configuration(dataBits: 8);
use PhpSerial\Configuration;
$config = new Configuration(stopBits: Configuration::STOP_BITS_1);
// または
$config = new Configuration(stopBits: Configuration::STOP_BITS_2);
$config = new Configuration();
$config
->setBaudRate(115200)
->setDataBits(8)
->setParity(Configuration::PARITY_NONE)
->setStopBits(Configuration::STOP_BITS_1);
$port = new SerialPort('COM3');
$port = new SerialPort('/dev/ttyUSB0');
// または
$port = new SerialPort('/dev/ttyACM0');
$port = new SerialPort('/dev/tty.usbserial');
bash
composer
bash
composer
ini
extension=ffi
ffi.enable=true
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.