Skip to content

Commit

Permalink
Merge pull request #17 from docusign/DCM-118_Naveen
Browse files Browse the repository at this point in the history
Shiny NEW DocuSign PHP client v2.0
  • Loading branch information
gsnavin committed Feb 19, 2016
2 parents 729c417 + 30731f8 commit c13341a
Show file tree
Hide file tree
Showing 372 changed files with 113,263 additions and 2,790 deletions.
Binary file removed DevCon.jpg
Binary file not shown.
143 changes: 78 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,104 @@
DocuSign PHP Client
================================
e
This is a client library to help you get started with DocuSign eSignature API.
To get started with using this library go to <a href="http://www.docusign.com/devcenter">http://www.docusign.com/devcenter</a> and get
a free development account. After you get an account and generate an Integrator Key (App Key)
you will be able to make test web service calls. To generate your Integrator Key login to your developer
account and go to Preferences -> API page.
# DocuSign PHP Client

The JSON parsing is done through PHP's native `json_encode()` and `json_decode()` functions, available with
PHP 5.2.x and higher. To see examples of how the library can be used for most frequently used scenarios
look in the test directory. The sub folders contain unit tests, as well as /examples folders which
showcase the most frequent usage scenarios.
You can sign up for a free [developer sandbox](https://www.docusign.com/developer-center).

NOTE: it does not and will not have the full functionality of the DocuSign service.
Feel free to update the proxy classes yourself and contribute functions.
Alternatively you can get the raw HTTP connection and send over your own JSON.
For full functionality and documentation visit www.docusign.com/devcenter and iodocs.docusign.com
Requirements
============

PHP 5.3.3 or higher [http://www.php.net/].

Library Configuration
-------------------------
Installation
============

To use this library you need to enter your account specific info in the `config.php` configuration file.
Test data can also be entered into the `testConfig.php` file for unit testing and examples.
Do a search for the string "TODO" to locate places that require specific info to be entered.
### Composer

You can install the bindings via Composer. Run the following command:

System Requirements
-------------------------
composer require docusign/docusign-esign

- PHP 5.2.x or higher [http://www.php.net/]
- PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
- PHP JSON extension [http://php.net/manual/en/book.json.php]
### Manual Install

This client library was tested with PHP 5.3.15.
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.

require_once('/path/to/docusign-esign/autoload.php');

Important Terms
-------------------------
#### Dependencies

`Integrator Key`: Identifies a single integration. Every API
request includes the Integrator Key and a
username/password combination
This client has the following external dependencies:

`Envelope`: Just like a normal Postal Envelope.It contains
things like Documents, Recipients, and Tabs
* PHP Curl extension [http://www.php.net/manual/en/intro.curl.php]
* PHP JSON extension [http://php.net/manual/en/book.json.php]

`Document`: The PDF, Doc, Image, or other item you want
signed. If it is not a PDF, you must include the File
Extension in the API call
Usage
=====

`Tab`: Tied to a position on a Document and defines what
happens there. For example, you have a SignHere Tab
wherever you want a Recipient to sign
To initialize the client and make the Login API Call:

`Recipient`: The person you want to send the Envelope
to. Requires a UserName and Email
```php
<?php
class DocuSignSample
{
public function login()
{
$username = "[EMAIL]";
$password = "[PASSWORD]";
$integrator_key = "[INTEGRATOR_KEY]";
$host = "https://demo.docusign.net/restapi";

`Captive Recipient`: Recipient signs in an iframe on your
website instead of receving an email. Captive recipients have the
clientUserId property set.
$config = new DocuSign\eSign\Configuration();
$config->setHost($host);
$config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}");

`PowerForm`: A pre-created Envelope that you can launch
instead of writing server-side code
$apiClient = new DocuSign\eSign\ApiClient($config);

Rate Limits
-------------------------
$authenticationApi = new DocuSign\eSign\Api\AuthenticationApi($apiClient);

Please note: Applications are not allowed to poll for envelope status more
than once every 15 minutes and we discourage integrators from continuously
retrieving status on envelopes that are in a terminal state (Completed,
Declined, and Voided). Excessive polling will result in your API access
being revoked.
If you need immediate notification of envelope events we encourage you to
review envelope events or use our Connect Publisher technology, DocuSign
Connect as an alternative.
$options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();

$loginInformation = $authenticationApi->login($options);
if(isset($loginInformation) && count($loginInformation) > 0)
{
$loginAccount = $loginInformation->getLoginAccounts()[0];
if(isset($loginInformation))
{
$accountId = $loginAccount->getAccountId();
if(!empty($accountId))
{
echo $accountId;
}
}
}
}
}
?>
```

See [UnitTests.php](https://github.com/docusign/docusign-php-client/blob/master/test/UnitTests.php) for more examples.

Testing
=======

Unit tests are available in the [test](/test) folder.

Follow the steps below to run the test cases

* Rename the "TestConfig.php-sample" to "TestConfig.php"
* Populate all the required values like the login credentials, integrator key, host, etc in TestConfig.php
* Run the following command from the [test](/test) folder

phpunit.phar UnitTests.php

Support
=======

Feel free to log issues against this client through GitHub. We also have an active developer community on Stack Overflow, search the [DocuSignAPI](http://stackoverflow.com/questions/tagged/docusignapi) tag.

License
-------------------------
=======

The DocuSign PHP Client is licensed under the following [License](LICENSE).

More Information
-------------------------

Professional Services is also available to help define and implement your
project fast.
Notes
=======

You can also find a lot of answered questions on StackOverflow, search for tag `DocuSignApi`:
http://stackoverflow.com/questions/tagged/docusignapi
This version of the client library does not implement all of the DocuSign REST API methods. The current client omits methods in the Accounts, Billing, Cloud Storage, Connect, Groups (Branding), and Templates (Bulk Recipients) categories. The client's methods support the core set of use cases that most integrations will encounter. For a complete list of omitted endpoints, see [Omitted Endpoints](./omitted_endpoints.md).
41 changes: 41 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* An example of a project-specific implementation.
*
* After registering this autoload function with SPL, the following line
* would cause the function to attempt to load the \DocuSign\eSign\Baz\Qux class
* from /path/to/project/src/Baz/Qux.php:
*
* new \DocuSign\eSign\Baz\Qux;
*
* @param string $class The fully-qualified class name.
* @return void
*/
spl_autoload_register(function ($class) {

// project-specific namespace prefix
$prefix = 'DocuSign\\eSign\\';

// base directory for the namespace prefix
$base_dir = __DIR__ . '/src/';

// does the class use the namespace prefix?
$len = strlen($prefix);
if (strncmp($prefix, $class, $len) !== 0) {
// no, move to the next registered autoloader
return;
}

// get the relative class name
$relative_class = substr($class, $len);

// replace the namespace prefix with the base directory, replace namespace
// separators with directory separators in the relative class name, append
// with .php
$file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';

// if the file exists, require it
if (file_exists($file)) {
require $file;
}
});
36 changes: 26 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
{
"name": "docusign/docusign-php-client",
"description": "DocuSign eSignignature PHP Client Library",
"name": "DocuSign/DocuSign-eSign",
"version": "2.0.0",
"description": "The DocuSign PHP library makes integrating DocuSign into your websites a super fast and painless process. The library is open sourced on GitHub, look for the docusign-php-client repository. Join the eSign revolution!",
"keywords": [
"swagger",
"php",
"sdk",
"api"
],
"homepage": "https://www.docusign.com/developer-center",
"license": "MIT",
"authors": [
{
"name": "DocuSign"
"name": "DocuSign",
"homepage": "https://www.docusign.com/developer-center"
}
],
"require": {
"php": ">=5.3.0"
},
"require": {
"php": ">=5.3.3",
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"satooshi/php-coveralls": "~0.6.1",
"squizlabs/php_codesniffer": "~2.0"
},
"autoload": {
"files": [
"src/DocuSign_Client.php"
]
"files": [ "autoload.php" ]
}
}
}
58 changes: 58 additions & 0 deletions omitted_endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
## Omitted Endpoints

The following endpoints are not included in the client libraries.

| Method | Endpoint |
| --- | --- |
| POST | {vx}/accounts |
| DELETE | {vx}/accounts/{accountId} |
| GET | {vx}/accounts/{accountId}/billing_charges |
| GET | {vx}/accounts/{accountId}/billing_invoices |
| GET | {vx}/accounts/{accountId}/billing_invoices_past_due |
| GET | {vx}/accounts/{accountId}/billing_invoices/{invoiceId} |
| GET | {vx}/accounts/{accountId}/billing_payments |
| POST | {vx}/accounts/{accountId}/billing_payments |
| GET | {vx}/accounts/{accountId}/billing_payments/{paymentId} |
| GET | {vx}/accounts/{accountId}/billing_plan |
| PUT | {vx}/accounts/{accountId}/billing_plan |
| PUT | {vx}/accounts/{accountId}/billing_plan/purchased_envelopes |
| DELETE | {vx}/accounts/{accountId}/brands |
| GET | {vx}/accounts/{accountId}/brands |
| POST | {vx}/accounts/{accountId}/brands |
| GET | {vx}/accounts/{accountId}/bulk_envelopes |
| GET | {vx}/accounts/{accountId}/bulk_envelopes/{batchId} |
| GET | {vx}/accounts/{accountId}/connect |
| POST | {vx}/accounts/{accountId}/connect |
| PUT | {vx}/accounts/{accountId}/connect |
| DELETE | {vx}/accounts/{accountId}/connect |
| GET | {vx}/accounts/{accountId}/connect/{connectId} |
| POST | {vx}/accounts/{accountId}/connect/{connectId} |
| PUT | {vx}/accounts/{accountId}/connect/{connectId} |
| DELETE | {vx}/accounts/{accountId}/connect/{connectId} |
| DELETE | {vx}/accounts/{accountId}/connect/mobile_notifiers |
| GET | {vx}/accounts/{accountId}/connect/mobile_notifiers |
| PUT | {vx}/accounts/{accountId}/connect/mobile_notifiers |
| GET | {vx}/accounts/{accountId}/consumer_disclosure |
| GET | {vx}/accounts/{accountId}/consumer_disclosure/{langCode} |
| DELETE | {vx}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/bulk_recipients |
| GET | {vx}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/bulk_recipients |
| PUT | {vx}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/bulk_recipients |
| GET | {vx}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/consumer_disclosure |
| GET | {vx}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/consumer_disclosure/{langCode} |
| DELETE | {vx}/accounts/{accountId}/groups/{groupId}/brands |
| GET | {vx}/accounts/{accountId}/groups/{groupId}/brands |
| PUT | {vx}/accounts/{accountId}/groups/{groupId}/brands |
| GET | {vx}/accounts/{accountId}/templates/{templateId}/documents/{documentId}/pages/{pageNumber}/page_image |
| DELETE | {vx}/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients |
| GET | {vx}/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients |
| PUT | {vx}/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/bulk_recipients |
| DELETE | {vx}/accounts/{accountId}/users/{userId}/cloud_storage |
| GET | {vx}/accounts/{accountId}/users/{userId}/cloud_storage |
| POST | {vx}/accounts/{accountId}/users/{userId}/cloud_storage |
| DELETE | {vx}/accounts/{accountId}/users/{userId}/cloud_storage/{serviceId} |
| GET | {vx}/accounts/{accountId}/users/{userId}/cloud_storage/{serviceId} |
| GET | {vx}/accounts/{accountId}/users/{userId}/cloud_storage/{serviceId}/folders |
| GET | {vx}/accounts/{accountId}/users/{userId}/cloud_storage/{serviceId}/folders/{folderId} |
| GET | {vx}/accounts/provisioning |
| GET | {vx}/billing_plans |
| GET | {vx}/billing_plans/{billingPlanId} |
Loading

0 comments on commit c13341a

Please sign in to comment.