承接 sanchescom/php-serial 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sanchescom/php-serial

最新稳定版本:2.0.3

Composer 安装命令:

composer require sanchescom/php-serial

包简介

Multi-platform serial port access convenience class

README 文档

README

Multi-platform convenience class to access the serial port from PHP. This is refactored version of sources library PHP-Serial. Current version rewrite on PHP 7.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Installing

Require this package, with Composer, in the root directory of your project.

$ composer require sanchescom/php-serial

Usage

<?php

use Sanchescom\Serial\Serial;

try {
    $serial = new Serial();
    
    // First we must specify the device. This works on both linux and windows (if
    // your linux serial device is /dev/ttyS0 for COM1, etc)
    $device = $serial->setDevice('COM5');

    // We can change the baud rate, parity, length, stop bits, flow control
    $device->setBaudRate(2400);
    $device->setParity("none");
    $device->setCharacterLength(8);
    $device->setStopBits(1);
    $device->setFlowControl("none");

    // Then we need to open it
    $device->open();

    // To write into
    $device->send('Hello!');

    // Or to read from
    $read = $device->read();

    // If you want to change the configuration, the device must be closed
    $device->close();

    // We can change the baud rate
    $device->setBaudRate(2400);
} catch (Exception $e) {

}

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Efimov Aleksandr - Refactoring and supporting work - Sanchescom
  • Rémy Sanchez - Initial work - Xowap

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Platform support

  • Linux: the initially supported platform, the one I used. Probably the less buggy one.
  • MacOS: although I never tried it on MacOS, it is similar to Linux and some patches were submitted to me, so I guess it is OK
  • Windows: it seems to be working for some people, not working for some others. Theoretically there should be a way to get it done.

统计信息

  • 总下载量: 1.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 233
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2019-07-16