jot/hf-hkvsn
Composer 安装命令:
composer require jot/hf-hkvsn
包简介
SDK for HikVision devices
README 文档
README
SDK for HikVision face recognition devices, with Hyperf 3.1 compatibility.
Features
- Device information and capabilities retrieval
- User management
- Face recognition management
- Card management
- Door control
- Event monitoring
- Full Hyperf 3.1 compatibility
Requirements
- PHP 8.1 or higher
- Hyperf 3.1 framework (for Hyperf integration)
- GuzzleHTTP 7.8 or higher
- Various PHP extensions (see composer.json)
Installation
composer require jot/HikVision
Usage with Hyperf 3.1
<?php use Jot\HikVision\Device\DSK1T673DWX\Device; // Create device instance $device = new Device([ 'protocol' => 'http', 'ip_address' => '192.168.1.100', 'port' => 80, 'username' => 'admin', 'password' => 'admin', ]); // Get device information $info = $device->info()->toArray(); // Get device capabilities $capabilities = $device->capabilities()->toArray(); // Update device configuration $result = $device->update([ 'name' => 'My Device', 'ntp' => [ 'ip_address' => '200.186.125.195', 'port' => 123, 'interval' => 1, ], ])->toArray();
Hyperf 3.1 Integration
This library provides Hyperf 3.1 compatible classes for integration with the Hyperf framework:
Configuration
Create a configuration file in your Hyperf project:
// config/autoload/dependencies.php use Hyperf\Guzzle\ClientFactory; use Jot\HikVision\HyperfDevice; return [ // Register the ClientFactory as a singleton in the container ClientFactory::class => ClientFactory::class, // Register a device with default configuration 'device.default' => function(ClientFactory $clientFactory) { $config = [ 'protocol' => 'http', 'ip_address' => '192.168.1.100', 'port' => 80, 'username' => 'admin', 'password' => 'admin', ]; $device = new HyperfDevice($config); // Manually inject the ClientFactory since we're not using annotations here $device->clientFactory = $clientFactory; return $device; }, ];
Using with Dependency Injection
Create a service class to encapsulate device operations:
<?php declare(strict_types=1); namespace App\Service; use Hyperf\Di\Annotation\Inject; use Hyperf\Guzzle\ClientFactory; use Jot\HikVision\HyperfDevice; class DeviceService { /** * @Inject * @var ClientFactory */ protected ClientFactory $clientFactory; public function createDevice(array $config): HyperfDevice { $device = new HyperfDevice($config); // Manually inject the ClientFactory $device->clientFactory = $this->clientFactory; return $device; } public function getDeviceInfo(array $config): array { $device = $this->createDevice($config); return $device->info()->toArray(); } // Add more methods as needed... }
Use the service in your controller:
<?php declare(strict_types=1); namespace App\Controller; use App\Service\DeviceService; use Hyperf\Di\Annotation\Inject; use Hyperf\HttpServer\Contract\RequestInterface; use Hyperf\HttpServer\Contract\ResponseInterface; use Hyperf\HttpServer\Annotation\Controller; use Hyperf\HttpServer\Annotation\RequestMapping; /** * @Controller(prefix="/api/device") */ class DeviceController { /** * @Inject * @var RequestInterface */ protected RequestInterface $request; /** * @Inject * @var ResponseInterface */ protected ResponseInterface $response; /** * @Inject * @var DeviceService */ protected DeviceService $deviceService; /** * @RequestMapping(path="info", methods="get") */ public function info(): ResponseInterface { $config = [ 'protocol' => $this->request->input('protocol', 'http'), 'ip_address' => $this->request->input('ip', '192.168.1.100'), 'port' => (int) $this->request->input('port', 80), 'username' => $this->request->input('username', 'admin'), 'password' => $this->request->input('password', 'admin'), ]; $info = $this->deviceService->getDeviceInfo($config); return $this->response->json($info); } // Add more endpoints as needed... }
License
Proprietary - All rights reserved
jot/hf-hkvsn 适用场景与选型建议
jot/hf-hkvsn 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jot/hf-hkvsn 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jot/hf-hkvsn 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2025-03-17