定制 signnow/api-php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

signnow/api-php-sdk

最新稳定版本:v3.5.0

Composer 安装命令:

composer require signnow/api-php-sdk

包简介

Library to communicate with SignNow API

README 文档

README

v3.5.0

PHP Version

Requirements

  • PHP 8.2 or higher
  • composer
  • cURL extension

Installation

Get SDK code via composer

composer require signnow/api-php-sdk:v3

or via git

git clone git@github.com:signnow/SignNowPHPSDK.git

Install dependencies

make install

Configuration

Copy .env.example to .env and fill your credentials in the required values

cp .env.example .env

Run tests

To run tests you need to have a valid .env.test file with credentials for testing. If you don't have it, you can create it by copying the .env.test.dist file and renaming it to .env.test. However, the file will be created automatically if you just run test execution with the following commands:

## Run mock server locally
make mock-up
## Run all the tests
make tests
## Run a single test by specified argument
make test T=Document/DocumentTest.php

Mock server will be available at http://0.0.0.0:8086.

Usage

To start using the SDK, you need to create a new instance of the SDK API client and authenticate it using the credentials from the .env file.

require_once __DIR__ . '/vendor/autoload.php';

use SignNow\ApiClient;
use SignNow\Api\Document\Request\DocumentGet;
use SignNow\Exception\SignNowApiException;
use SignNow\Sdk;

$sdk = new Sdk();

try {
    // Method authenticate() will use the credentials from the .env file
    // and create a new bearer token for further requests
    $apiClient = $sdk->build()
        ->authenticate()
        ->getApiClient();
    // Now, you are ready to use the API client to send requests

    // if you want to keep the token, you can use the following code
    $bearerToken = $sdk->actualBearerToken();
    // or
    $bearerToken = $apiClient->getBearerToken();
} catch (SignNowApiException $e) {
    echo $e->getMessage();
}

If you have already received a bearer token and wish to reuse it, then the following API client initialization scheme will be useful:

require_once __DIR__ . '/vendor/autoload.php';

use SignNow\ApiClient;
use SignNow\Api\Document\Request\DocumentGet;
use SignNow\Core\Token\BearerToken;
use SignNow\Exception\SignNowApiException;
use SignNow\Sdk;

$sdk = new Sdk();

try {
    $token = 'YOUR_TOKEN_HERE';
    $apiClient = $sdk->build()
        ->withBearerToken(new BearerToken($token, '', 0))
        ->getApiClient();
    // Now, you are ready to use the API client to send requests
} catch (SignNowApiException $e) {
    echo $e->getMessage();
}

Example of sending a request to get a document by id:

require_once __DIR__ . '/vendor/autoload.php';

use SignNow\ApiClient;
use SignNow\Api\Document\Request\DocumentGet;
use SignNow\Exception\SignNowApiException;
use SignNow\Sdk;

$sdk = new Sdk();

try {
    // Instantiate the API client
    $apiClient = $sdk->build()
        ->authenticate()
        ->getApiClient();

    // Prepare a request to get a document by id
    $documentId = 'e896ec9311a74a8a8ee9faff7049446fe452e461';
    $request = new DocumentGet();
    $request->withDocumentId($documentId);

    // Send the request and get the response
    $response = $apiClient->send($request);
} catch (SignNowApiException $e) {
    echo $e->getMessage();
}

Examples

You can find more examples of API usage in the examples directory.

统计信息

  • 总下载量: 116.87k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 5
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固