PHPackages                             neteast/ys7 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. neteast/ys7

ActiveLibrary[API Development](/categories/api)

neteast/ys7
===========

海康威视设备萤石开放平台(萤石云)PHP SDK,用于接入海康设备直播,通信等功能

0.2.2(4y ago)152764[2 issues](https://github.com/Xavier-Lam/ys7/issues)MITPHPPHP &gt;=5.3

Since Sep 4Pushed 3y ago2 watchersCompare

[ Source](https://github.com/Xavier-Lam/ys7)[ Packagist](https://packagist.org/packages/neteast/ys7)[ Docs](https://github.com/Xavier-Lam/ys7)[ RSS](/packages/neteast-ys7/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

萤石开放平台PHP SDK
=============

[](#萤石开放平台php-sdk)

[![Packagist Version](https://camo.githubusercontent.com/5d262c66ae16efcfcef38c0850f6ad1e99242094a8c0f25ef54440864d54a87c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6574656173742f797337)](https://packagist.org/packages/neteast/ys7)[![Donate with Bitcoin](https://camo.githubusercontent.com/d4b81c96f0230290ebc2fafb666e29cc97168d7b70bb4de278a754e115d31c4e/68747470733a2f2f656e2e63727970746f6261646765732e696f2f62616467652f6d6963726f2f3142644a4733317a696e724d4657785274327574474255326a647076387853676a75)](https://en.cryptobadges.io/donate/1BdJG31zinrMFWxRt2utGBU2jdpv8xSgju)

海康威视设备萤石开放平台(萤石云)PHP SDK,用于接入海康设备直播,通信等功能

官方文档:

>

Installation
------------

[](#installation)

```
composer require neteast/ys7

```

Quickstart
----------

[](#quickstart)

```
use Neteast\YS7\YS7Auth;
use Neteast\YS7\YS7Client;

$auth = new YS7Auth($appKey, $appSecret);
$client = new YS7Client($auth);

// 新增设备
$client->device->add($deviceSerial, $validateCode);

// 获取设备列表
$devices = $client->device->list();

// 获取设备信息
$info = $client->device->info($deviceSerial);

// 获取摄像头列表
$cameras = $client->device->camera->list();

// 根据设备获取摄像头列表
$cameras = $client->device->cameras($deviceSerial);

// 关闭加密功能
$client->device->configuration->setEncrypt($deviceSerial, $validateCode, false);

// 开启下线通知
$client->device->configuration->setNotify($deviceSerial, true);

```

### 云台

[](#云台)

```
// 控制云台转动
$client->ptz->start($deviceSerial, \Neteast\YS7\Enum\PTZ::DIRECTION_UP);
sleep(1);
$client->ptz->stop();

```

### 地址获取

[](#地址获取)

```
// 开通直播功能
$client->live->open($deviceSerial, $channelNo);

// 获取直播地址
$data = $client->live->address($deviceSerial, $expiresIn, $channelNo);

// 获取录像列表
$records = $client->device->records($deviceSerial);

// 获取ezopen直播地址
$addr = $client->ezopen->live($deviceSerial, $channelNo);
// 获取ezopen录像地址
$addr = $client->ezopen->rec($deviceSerial, $channelNo, 1598940000);

```

### 通知

[](#通知)

```
// 通知
$consumer = $client->consumer();
$consumer->addHandler(function(\Neteast\YS7\Message\DataObject\Message $message, \Neteast\YS7\Message\Consumer $consumer, YS7Client $client) {
    // 你的处理业务逻辑
});

// 开始消费消息
while(true) {
    $consumer->consume();
    sleep(30);
}

```

### 子账号

[](#子账号)

```
// 创建子账号
$accountId = $client->ram->account->create($accountName, $password);

// 获取子账号信息
$data = $client->ram->account->get($accountId);

// 设置子账号权限策略
use Neteast\YS7\Policy\Permission;
use Neteast\YS7\Policy\Resource;
use Neteast\YS7\Policy\Statement;

$devices = [Resource::create($deviceSerial, $channelNo)];
$permissions = [Permission::UPDATE];
$statements = [Statement::create($permissions, $devices)];
$client->ram->policy->set($statements);

// 获取子账号auth
$auth = $client->ram->token->get($accountId);

// 使用子账号
$client = new YS7Client($auth);
$client->device->list();

```

TODOS
-----

[](#todos)

- 消息处理相关信号

Contribute
----------

[](#contribute)

对于需要使用并未封装的api,可依照本类库封装风格进行封装,通过pull request合作开发

Changelog
---------

[](#changelog)

### 0.2.0

[](#020)

- 拆分httpclient

### 0.1.0

[](#010)

- 基本功能封装

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~212 days

Total

3

Last Release

1657d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47b0c006c39c7e6d87a965394289a8d882138a4da2bf07f3b9c0365894877515?d=identicon)[Xavier-Lam](/maintainers/Xavier-Lam)

---

Top Contributors

[![Xavier-Lam](https://avatars.githubusercontent.com/u/8982940?v=4)](https://github.com/Xavier-Lam "Xavier-Lam (10 commits)")[![manhere](https://avatars.githubusercontent.com/u/580122?v=4)](https://github.com/manhere "manhere (1 commits)")[![puzzle9](https://avatars.githubusercontent.com/u/13518196?v=4)](https://github.com/puzzle9 "puzzle9 (1 commits)")

---

Tags

ezuikitezvizhikvisionphp-sdkysopenhikvision

### Embed Badge

![Health badge](/badges/neteast-ys7/health.svg)

```
[![Health](https://phpackages.com/badges/neteast-ys7/health.svg)](https://phpackages.com/packages/neteast-ys7)
```

###  Alternatives

[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5723.1M30](/packages/thecodingmachine-graphqlite)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k379.4k24](/packages/team-reflex-discord-php)[wordpress/php-ai-client

A provider agnostic PHP AI client SDK to communicate with any generative AI models of various capabilities using a uniform API.

26236.6k14](/packages/wordpress-php-ai-client)[wordpress/wp-ai-client

An AI client and API for WordPress to communicate with any generative AI models of various capabilities using a uniform API.

11117.5k1](/packages/wordpress-wp-ai-client)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

7228.4k](/packages/n1ebieski-ksef-php-client)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
