m3m0r7/nfc-for-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

m3m0r7/nfc-for-php

Composer 安装命令:

composer require m3m0r7/nfc-for-php

包简介

NFC Reader written in PHP

README 文档

README

This library is a toy for me. You can read NFC with libnfc written in PHP.

Requirements

  • PHP 7.4+
  • PHP FFI
  • libnfc 1.8.0 (if you use NFC reader for PaSoRi RC-S330)
  • libusb 1.0.24 (if you use NFC reader for PaSoRi RC-S380)

Tested

Quick start

Mac

RC-S330

  1. Install libnfc
$ brew install libnfc
  1. Install this library
$ composer require m3m0r7/nfc-for-php
  1. Connect NFC Device into your machine.
  2. Run example code
$ cd /path/to/nfc-for-php
$ php examples/nfc-poll-simple.php
  1. Put your NFC

  1. You can get output.

RC-S380

  1. Install libusb
$ brew install libusb
  1. Install this library
$ composer require m3m0r7/nfc-for-php
  1. Connect NFC Device into your machine.
  2. Run example code
$ cd /path/to/nfc-for-php
$ php examples/rcs380-nfc-poll-simple.php
  1. Put your NFC
  2. You can get output.

NFC binary

We're providing NFC binary in vendor/bin. And you can use 3 commands start, ls and version

start

Start to listen NFC reader.

./vendor/bin/nfc start

You can change the driver if you want to use other driver.

./vendor/bin/nfc start -D DriverName

You can specify hook events in CLI command.

./vendor/bin/nfc start -E /path/to/events.php

For example, you can use example file.

./vendor/bin/nfc start -E ./vendor/m3m0r7/nfc-for-php/examples/event-manager.php

And you want to more details, please run below command.

./vendor/bin/nfc start --help

ls

Show available devices.

./vendor/bin/nfc ls

You can change the driver if you want to use other driver.

./vendor/bin/nfc ls -D DriverName

And you want to more details, please run below command.

./vendor/bin/nfc ls --help

version

Show PHP driver version.

./vendor/bin/nfc version

You can change the driver if you want to use other driver.

./vendor/bin/nfc version -D DriverName

And you want to more details, please run below command.

./vendor/bin/nfc version --help

How to use

  • See examples

Troubleshooting

Q. How to recognize a device?

A. You must have granted permission to user. I already test on RaspberryPI (Raspbian), it should grant to access permission to /dev/* or using super user (e.g., the root user). If you did not have permissions, cannot recognize a device on your environment and the libusb return an error LIBUSB_ERROR_ACCESS.

Q. Cannot start second time or later on macOS

A. You must reconnect the connected USB plug because libnfc/libusb return an invalid packet in the macOS when second time or later. I don't know how to fix it.

License

  • MIT

m3m0r7/nfc-for-php 适用场景与选型建议

m3m0r7/nfc-for-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105 次下载、GitHub Stars 达 28, 最近一次更新时间为 2021 年 10 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 m3m0r7/nfc-for-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 m3m0r7/nfc-for-php 我们能提供哪些服务?
定制开发 / 二次开发

基于 m3m0r7/nfc-for-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 105
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-10