Skip to content

Latest commit

 

History

History

templates

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
# {{packageName}}

{{#appDescriptionWithNewLines}}
{{{.}}}
{{/appDescriptionWithNewLines}}

{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}).
{{/infoUrl}}

{{#useCustomTemplateCode}}
## Migrating from legacy SDK

This SDK is generated from our officially maintained [OpenAPI spec](https://github.com/hellosign/hellosign-openapi/blob/main/openapi.yaml).
We've made important updates that introduce new functionality and create feature parity between the Dropbox Sign API and the SDK.
However, some of these changes are considered "breaking" in the sense that they'll require you to update your existing code in order to continue using the SDK.
Please refer to this [migration guide](https://developers.hellosign.com/docs/sdks/php/migration-guide/) for more information.

## Contributing

This repo is no longer accepting new issues or Pull Requests. All issues or
Pull Requests *must* be opened against the
[hellosign/hellosign-openapi](https://github.com/hellosign/hellosign-openapi) repo!

### Changes to the SDK code

You must make SDK code changes in the mustache file within the `templates`
directory that corresponds to the file you want updated.

We use [OpenAPI Generator](https://openapi-generator.tech/) to automatically
generate this SDK from the OAS, using the template files.

### Building

You must have `docker` (or `podman` linked to `docker`) installed. Highly
recommended to use
[rootless docker](https://docs.docker.com/engine/security/rootless/).

Run the following and everything is done for you:

```shell
./run-build
```

*Attention*: Any changes you have made to the SDK code that you have not made
to the OAS file and/or the mustache template files _will be lost_ when you run
this command.

{{/useCustomTemplateCode}}
## Installation & Usage

### Requirements

{{^useCustomTemplateCode}}
PHP 7.4 and later.
Should also work with PHP 8.0.
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
PHP {{phpVersion}} and later.
{{/useCustomTemplateCode}}

### Composer

To install the bindings via [Composer](https://getcomposer.org/), add the following to `composer.json`:

```json
{{^useCustomTemplateCode}}
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.git"
    }
  ],
  "require": {
    "{{gitUserId}}/{{gitRepoId}}": "*@dev"
  }
}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
{
    "require": {
        "{{packageName}}": "{{packageVersion}}"
    },
    "minimum-stability": "dev"
}
{{/useCustomTemplateCode}}
```

Then run `composer install`

{{^useCustomTemplateCode}}
### Manual Installation

Download the files and include `autoload.php`:

```php
<?php
require_once('/path/to/{{packageName}}/vendor/autoload.php');
```
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
Alternatively, install directly with

```
composer require {{packageName}}:{{packageVersion}}
```
{{/useCustomTemplateCode}}

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

{{^useCustomTemplateCode}}
```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');

{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
{{> php_doc_auth_partial}}
$apiInstance = new {{invokerPackage}}\Api\{{classname}}(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(){{#hasAuthMethods}},
    $config{{/hasAuthMethods}}
);
{{#allParams}}${{paramName}} = {{{example}}}; // {{{dataType}}}{{#description}} | {{{.}}}{{/description}}
{{/allParams}}

try {
    {{#returnType}}$result = {{/returnType}}$apiInstance->{{{operationId}}}({{#allParams}}${{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}}
    print_r($result);{{/returnType}}
} catch (Exception $e) {
    echo 'Exception when calling {{classname}}->{{operationId}}: ', $e->getMessage(), PHP_EOL;
}
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
```php
REPLACE_ME_WITH_EXAMPLE_FOR__{{{operationId}}}_PHP_CODE
```
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
You may also instantiate objects by calling the class' `::init()` method:

```php
<?php

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

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");

$api = new Dropbox\Sign\Api\SignatureRequestApi($config);

$data = Dropbox\Sign\Model\SignatureRequestSendRequest::init([
    "title"   => "NDA with Acme Co.",
    "signers" => [
        [
            "email_address" => "[email protected]",
            "name"          => "Jack",
            "order"         => 0,
        ],
        [
            "email_address" => "[email protected]",
            "name"          => "Jill",
            "order"         => 1,
        ],
    ],
    "files"    => [
        new SplFileObject("/absolute/path/to/file.pdf"),
    ],
]);

try {
    $result = $api->signatureRequestSend($data);
    print_r($result);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling Dropbox Sign API: "
        . $e->getMessage() . PHP_EOL;
}
```
{{/useCustomTemplateCode}}

## API Endpoints

All URIs are relative to *{{basePath}}*

{{^useCustomTemplateCode}}
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
| Class      | Method        | HTTP request  | Description   |
| ---------- | ------------- | ------------- | ------------- |
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}| *{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{summary}} |
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}

{{/useCustomTemplateCode}}
## Models

{{#models}}{{#model}}- [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md){{/model}}
{{/models}}

## Authorization
{{^useCustomTemplateCode}}
{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{/useCustomTemplateCode}}
{{#useCustomTemplateCode}}
{{^authMethods}}All endpoints do not require authorization.{{/authMethods}}
{{/useCustomTemplateCode}}
{{#authMethods}}
{{#useCustomTemplateCode}}
{{#last}} Authentication schemes defined for the API:{{/last}}
{{/useCustomTemplateCode}}
### {{{name}}}
{{#isApiKey}}

- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}

{{/isApiKey}}
{{#isBasic}}
{{#isBasicBasic}}

- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}

- **Type**: Bearer authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{^useCustomTemplateCode}}
{{#isHttpSignature}}

- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{/useCustomTemplateCode}}
{{/isBasic}}
{{#isOAuth}}

- **Type**: `OAuth`
- **Flow**: `{{{flow}}}`
- **Authorization URL**: `{{{authorizationUrl}}}`
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}}
    - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}
## Tests

To run the tests, use:

```bash
composer install
vendor/bin/phpunit
```

## Author

{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}
## About this package

This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: `{{appVersion}}`
{{#artifactVersion}}
    - Package version: `{{.}}`
{{/artifactVersion}}
{{^hideGenerationTimestamp}}
    - Build date: `{{generatedDate}}`
{{/hideGenerationTimestamp}}
    - Generator version: `{{generatorVersion}}`
- Build package: `{{generatorClass}}`