Download the PHP package creatcode/iotmonitor without Composer

On this page you can find all versions of the php package creatcode/iotmonitor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package iotmonitor

creatcode/iotmonitor

面向 Workerman 常驻进程的 IoT 基础组件,统一处理协议拆包以及数据库、Redis 连接的探活和断线重连。

安装

Webman 快速接入

在 Bootstrap 的 start() 中初始化。Webman 会在每个 Worker 进程启动后执行该方法:

需要自定义配置时,将包内 config/default.php 复制到项目配置目录后传入:

配置和日志回调均可省略。不要直接修改 vendor 内的默认配置,Composer 更新会覆盖这些改动。

配置约定

config/default.php 同时是运行时默认配置和项目配置模板,包含以下配置:

顶层配置覆盖默认值,protocol 按配置项合并;一旦传入 extra_packets,会整体替换默认特殊包配置。

其它内置框架接入

ThinkPHP

在服务提供者的 boot() 中初始化:

初始化器兼容 think\facade 和旧版静态入口。第二个参数可传入自定义 Redis 连接工厂,第三个参数为日志回调。

Laravel

在 AppServiceProvider::boot() 中初始化:

第二个参数为日志回调。

自定义框架或连接器接入

没有内置初始化器时,无需编写适配器类。只需在每个工作进程启动后提供数据库和 Redis 连接工厂:

统一约定如下:

组件默认通过数据库的 query() 或 select()、Redis 的 ping() 或 command('ping') 探活,并通过 close() 或 disconnect() 释放连接。

如果客户端不支持这些方法,只需补充探活和释放回调:

探活回调在连接不可用时应抛出异常,释放回调只负责关闭底层资源。组件会统一缓存、淘汰和重连。只有回调无法描述连接行为时,才需要实现 ConnectionProviderInterface;接口仅包含 getConnection()、ping() 和 disconnect()。

若需要为某个框架提供可复用适配器,只需将上述初始化代码封装到框架的 Worker 启动生命周期中,不需要继承包内类。适配器负责取得框架连接,连接生命周期仍由组件管理。

常驻进程生命周期

使用连接

初始化后无需重复注入连接:

read() 用于可安全重试的只读操作,连接异常时最多重试一次。数据库写操作使用 DbManager::call(),Redis 写操作使用 RedisManager::call(),默认不重放业务回调。允许降级的辅助任务可使用 DbManager::safeRead()、DbManager::safeCall()、RedisManager::safeRead() 或 RedisManager::safeWrite()。

协议

内置 ModbusTcpProtocol、ModbusRtuProtocol、LoRaProtocol 和 TemperatureProtocol。初始化组件时会自动应用协议配置;仅使用协议模块时可调用 BaseProtocol::configure() 单独配置。

自定义协议需继承 BaseProtocol,实现 input()、decodePayload(),并声明非空的 PROTOCOL_NAME 常量。

许可证

MIT


All versions of iotmonitor with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-redis Version *
workerman/workerman Version ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package creatcode/iotmonitor contains the following files

Loading the files please wait ...