PHPackages                             lin07ux/net-court - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lin07ux/net-court

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lin07ux/net-court
=================

NetCourt is a SDK for HangZhou NetCourt notary: original confirmation and obtain evidence.

v1.2.1(6y ago)068MITPHP

Since Dec 14Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Lin07ux/net-court)[ Packagist](https://packagist.org/packages/lin07ux/net-court)[ RSS](/packages/lin07ux-net-court/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (8)Used By (0)

NetCourt Notary
===============

[](#netcourt-notary)

Definitions
-----------

[](#definitions)

### Transaction

[](#transaction)

存证事务，可理解为逻辑上相关的一组证据，每个事务由一个事务 ID 相关联。一次事务由一个或多个存证阶段(phase)组成，每个阶段即一次实际存证请求。存证阶段可自定义，含义为自己理解和使用。

存证事务由一个全局唯一的 Token 作为凭证，该凭证由存证初始化接口完成资格核验后返回，供固定的存证人/公司多次使用，暂不不考虑失效条件。

### Entity

[](#entity)

进行存证业务的实体。该平台作为存证行为的发起者，需要经过互联网法院的认证，并得到分配的`accountId`和签名私钥。在进行存证时，需要使用该`accountId`作为标识，并用私钥对数据进行签名，方能通过认证，完成存证行为。

在进行存证时，可以选择将`Entity`信息也提交，也可以不提交，并不会影响存证结果。`Entity`信息类型为`Identity`，具体可以参见**Types - Identity**中的介绍。

### Customer

[](#customer)

存证客户，也即是存证的所有者。每次存证都必定是一个实名个人或有工商登记的公司企业主体。进行存证时，需要提交存证客户的基本信息，信息类型为`Identity`，具体可以参见**Types - Identity**中的介绍。

Notary
------

[](#notary)

目前存证服务器的域名为`https://check.netcourt.gov.cn`。API 接口有如下几个：

- `/api/blockChain/notaryToken` 获取存证事务 ID
- `/api/blockChain/notaryCert` 存证并获取证书

### Sign

[](#sign)

请求每个 API 的时候，都要对关键数据进行签名，以便存证服务器进行验证数据的可信性。

签名过程如下：将签名需要用到的数据拼接成一个字符串，然后使用密钥通过 Sha256WithRSA 算法进行加密，将得到的结果进行 Hex encode 成十六进制字符串后即为签名数据。计算签名的明文数据以 UTF-8 方式编码。

### notaryToken

[](#notarytoken)

每次进行存证时，必须提供一个事务 ID，以便可以将不同步骤的存证数据串联起来。事务 ID 可以使用之前已经获取过的，也可以通过`notaryToken`接口进行获取。该接口的描述如下：

```
RestFul URL: /api/blockChain/notaryToken
HTTP Method: POST
Request Content Type: application/json
Response Content Type: application/json

```

可通过如下方式使用：

```
use NetCourt\Business;
use NetCourt\NotaryClient;
use NetCourt\Identity\Person;

try {
    $customer = new Person(['certName' => 'Lin07ux', 'certNo' => '123456789012345678']);
    $business = new Business(Business::COPYRIGHT, Business::COPYRIGHT_TEXT);
    $notaryClient = new NotaryClient('accountId', 'privateKeyValue');

    $response = $notaryClient->createNotaryToken($customer, $business);
    $token = $response->getResponseData();
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

请求该接口时，需要提交如下的数据：

nametyperequiredcommentaccountIdstringyes账号标识entityIdentityno存证实体信息bizIdintegeryes业务类型标识，枚举字段，见**Types - bizId &amp; subBizId**subBizIdstringno子类型标识，字符串串，见**Types - bizId &amp; subBizId**customerIdentityyes客户身份标识，见**Types - Identity**timestampstringyes验签时间戳(毫秒值)，当前时刻，误差五分钟以内signedDatastringyes验签数据(accountId + bizId + timestamp)propertiesstringno扩展字段> 该接口的验签数据明文为`accountId`、`bizId`、`timestamp`三个字段拼接后的字符串。

该接口的响应数据如下：

nametyperequiredcommentsuccessstringyes成功标志codestringyes状态码，见**Types - Code**errMessagestringyes错误信息responseDatastringno事务 ID，全局唯⼀### notaryCert

[](#notarycert)

该接口用于存证，返回存证后的区块 hash 和存证证书。该接口的描述如下：

```
RestFul URL: /api/blockChain/notaryCert
HTTP Method: POST
Request Content Type: application/json
Response Content Type: application/multipart/form-data

```

可通过如下方式使用：

```
use NetCourt\Business;
use NetCourt\NotaryClient;
use NetCourt\Identity\Person;

try {
    $customer = new Person(['certName' => 'Lin07ux', 'certNo' => '123456789012345678']);
    $business = new Business(Business::COPYRIGHT, Business::COPYRIGHT_TEXT);
    $notaryClient = new NotaryClient('accountId', 'privateKeyValue');

    // Get the notary response
    $response = $notaryClient->createNotaryCert('token', 'right notary', 'something to notary');
    // Get notary hash
    $hash = $response->getResponseData();
    // Save the cert file
    $response->downloadCert('path/to/store/cert/file', $hash.'.pdf');
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

请求该接口时，需要提交如下的数据：

nametyperequiredcommentmetaNotaryMetayes存证元数据notaryContentstringno存证内容，一般为文件 SHA256 hash，或文本内容timestampstringyes验签时间戳(毫秒值)，当前时刻，误差五分钟以内signedDatastringyes验签数据(meta.accountId + meta.phase + timestamp)> 该接口的验签数据明文为`meta.accountId`、`meta.phase`、`timestamp`三个字段拼接后的字符串。

该接口的响应数据分为两部分：

- 响应结果数据放在 Body 中，以 JSON 字符串的形式返回。
- 请求响应成功时，会将存证证书的下载链接放在`Certurl` Header 中，使用这个 URL 就可以下载证书。证书是有有效期的，一般情况在半小时内下载最好。

解析 Body 可以得到如下的数据：

nametyperequiredcommentsuccessstringyes成功标志codestringyes状态码，见**Types - Code**errMessagestringno错误信息responseDatastringno存证上链后的区块 hash，通过此 hash 查询存证Types
-----

[](#types)

### Identity

[](#identity)

Identity 数据应为个人的实名信息或企业工商登记信息，主要包含如下的内容：

nametyperequiredcommentuserTypestringyes用户类别，可选值有：`PERSON`(个人)、`ENTERPRISE`(企业)certNamestringyes用户名称certTypestringyes证件类型，userType 为 PERSON 时，值只能为`IDENTITY_CARD`，
userType 为 ENTERPRISE，值可以为 `UNIFIED_SOCIAL_CREDIT_CODE`(统一社会信用代码) 和 `ENTERPRISE_REGISTERED_NUMBER`(企业工商注册号)certNostringyes证件号mobileNostringno手机号码legalPersonstringno法人姓名，userType 为 ENTERPRISE 时必须提供legalPersonIdstringno法人身份证，userType 为 ENTERPRISE 时必须提供agentstringno经办人姓名，userType 为 ENTERPRISE 时必须提供agentIdstringno经办人身份证，userType 为 ENTERPRISE 时必须提供propertiesstringno扩展属性字段### NotaryMeta

[](#notarymeta)

NotaryMeta 表示存证元数据，是进行确权时必须提供的信息，包含token、存证人/商家、存证时间、地点、存证阶段等。

nametyperequiredcommentaccountIdstringyes账号标识tokenstringyes事务 IDphasestringyes描述本条存证在存证事务中的阶段，用户可自行维护entityIdentityno存证实体信息locationLocationno存证时设备和网络的基本信息propertiesstringno扩展属性字段### Location

[](#location)

Location 表示进行存证时，操作设备(用户端)的网络、设备信息。

nametyperequiredcommentipstringyesIP地址wifiMacstringnoWi-Fi 物理理地址imeistringno操作 IMEIimsistringno操作 IMSIlatitudestringno纬度longitudestringno经度propertiesstringno扩展属性字段### Code

[](#code)

Code 表示 API 响应返回的状态码

CodeHTTP StatuscommentOK200请求成功ACCEPTED202存证或信息被接受BAD\_REQUEST400请求信息不不符合要求FORBIDDEN403无权限访问或授权失败NOT\_FOUND404资源未找到REQUEST\_TIMEOUT408请求超时CONFLICT409核验信息与链上信息不不符INTERNAL\_SERVER\_ERROR500服务器内部错误### bizId &amp; subBizId

[](#bizid--subbizid)

bizId 表示业务号，subBizId 表示子业务分类。

main typebizIdsub typesubBizIdCOPYRIGHT(版权)1视频VIDEO```
 -           |  -    | 音频      | AUDIO
 -           |  -    | 图像      | IMAGE
 -           |  -    | 文本      | TEXT

```

CONTRACT(合同) | 2 | HR 合同 | HR - | - | 租房合同 | HOUSERENTING - | - | 租赁合同 | LEASING - | - | 供应链合同 | SUPPLY\_CHAIN - | - | 旅游合同 | TRAVEL - | - | 教育合同 | EDUCATION - | - | 保险合同 | INSURANCE

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~70 days

Recently: every ~85 days

Total

7

Last Release

2286d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e3f9cbf65c04012c154f9210261d99e57249433aec6c4c0df5cd605d2be61242?d=identicon)[Lin07ux](/maintainers/Lin07ux)

---

Top Contributors

[![Lin07ux](https://avatars.githubusercontent.com/u/8132527?v=4)](https://github.com/Lin07ux "Lin07ux (23 commits)")

---

Tags

sdknet court

### Embed Badge

![Health badge](/badges/lin07ux-net-court/health.svg)

```
[![Health](https://phpackages.com/badges/lin07ux-net-court/health.svg)](https://phpackages.com/packages/lin07ux-net-court)
```

###  Alternatives

[infusionsoft/php-sdk

PHP SDK for the Infusionsoft

1292.1M7](/packages/infusionsoft-php-sdk)[corley/influxdb-sdk

Send your app metrics to InfluxDB

84296.5k2](/packages/corley-influxdb-sdk)

PHPackages © 2026

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