Download the PHP package mekari/esign-api-php without Composer
On this page you can find all versions of the php package mekari/esign-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package esign-api-php
esign-api-php
The esign-api-php is a PHP library that provides a convenient way to interact with Mekari eSign API. It simplifies the process of integrating eSign functionality into your PHP applications. With this SDK, you can easily create, manage, and sign documents using the eSign API.
Installing the SDK
Run the following command to install the SDK
Initializing the EsignApiClient SDK
The EsignApiClient class is the main entry point for interacting with the eSign API. Here's how to initialize it:
Prerequisites
Before you can initialize the EsignApiClient, you need to have the following:
- Client ID: This is the ID of your eSign API client.
- Client Secret: This is the secret of your eSign API client.
- Production Flag: This is a boolean flag indicating whether you're using the production environment. It's optional and defaults to
false.
Initialization
To initialize the EsignApiClient, you need to create a new instance of the EsignApiClient class and pass your client ID and client secret to the constructor. If you're using the production environment, you should also pass true as the third argument.
Here's an example:
Next Steps
After initializing the EsignApiClient, you can use its methods to interact with the eSign API. For example, you can use the auth method to get an instance of the Auth class, which provides methods for getting user authentication tokens and refresh tokens:
Authorization
Get Auth Token
The getUserAuthToken method is part of the Auth class. It's used to get a user authentication token from the eSign API.
Parameters
The method takes one parameter:
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the getUserAuthToken method:
Get Refresh Token
The getRefreshToken method is part of the Auth class. It's used to get a new access token from the eSign API using a refresh token.
Parameters
The method takes one parameter:
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the getRefreshToken method:
Global Sign
Request Global Sign
The requestGlobalSign method is part of the GlobalSign class. It's used to request a global sign for a document from the eSign API.
Parameters
The method takes the following parameters:
- $doc: The document to be signed
(base64). - $filename: The name of the file.
- $signers: The signers of the document.
- $signing_order: ordered signing or not.
- $callback_url: The callback URL to which the API should send the response.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the requestGlobalSign method:
PSRE Sign
Request PSRE Sign
The requestPsreSign method is part of the PsreSign class. It's used to request a PSRE sign for a document from the eSign API.
Parameters
The method takes the following parameters:
- $doc: The document to be signed
(base64). - $filename: The name of the file.
- $signers: The signers of the document.
- $signing_order: ordered signing or not.
- $callback_url: The callback URL to which the API should send the response.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the requestPsreSign method:
Generate Signing URL
The generateSigningUrl method is part of the PsreSign class. It's used to generate a signing URL for a document from the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the generateSigningUrl method:
Stamping
Stamp
The stamp method is part of the Stamping class. It's used to stamp a document with an annotation from the eSign API.
Parameters
The method takes the following parameters:
- $doc: The document to be stamped.
- $filename: The name of the file.
- $annotation: The annotation to be stamped on the document.
- $callback_url: The callback URL to which the API should send the response.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the stamp method:
Document
Get Document List
The getDocumentList method is part of the Document class. It's used to get a list of documents from the eSign API.
Parameters
The method takes the following parameters:
- $page: The page number.
- $limit: The number of documents per page.
- $token: The authentication token.
- $category (optional): The category of the documents (global, psre).
- $signing_status (optional): The signing status of the documents (in_progress, completed, voided, declined).
- $stamping_status (optional): The stamping status of the documents (none, in_progress, pending, failed, success).
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the getDocumentList method:
Get Document Detail
The getDocumentDetail method is part of the Document class. It's used to get the details of a specific document from the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the getDocumentDetail method:
Download Document
The downloadDocument method is part of the Document class. It's used to download a specific document from the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
Return Value
If the request is successful, the method returns the downloaded document. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the downloadDocument method:
Resend Document
The resendDocument method is part of the Document class. It's used to resend a specific document from the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
Return Value
If the request is successful, the method returns the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the resendDocument method:
Void Document
The voidDocument method is part of the Document class. It's used to void a specific document in the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
- $reason: The reason for voiding the document.
Return Value
If the request is successful, the method returns the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the voidDocument method:
Delete Document
The deleteDocument method is part of the Document class. It's used to delete a specific document from the eSign API.
Parameters
The method takes the following parameters:
- $documentId: The ID of the document.
- $token: The authentication token.
Return Value
If the request is successful, the method returns the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the deleteDocument method:
Auto Sign
Create Auto Sign
The createAutoSign method is part of the AutoSign class. It's used to create an auto sign request in the eSign API.
Parameters
The method takes the following parameters:
- $docMakerEmails: An array of document maker emails.
- $signerEmails: An array of signer emails.
- $token: The authentication token.
Return Value
If the request is successful, the method returns the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the createAutoSign method:
Update Auto Sign
The updateAutoSign method is part of the AutoSign class. It's used to update an auto sign request in the eSign API.
Parameters
The method takes the following parameters:
- $id: The ID of the auto sign request.
- $docMakerEmail: The email of the document maker.
- $signerEmail: The email of the signer.
- $token: The authentication token.
Return Value
If the request is successful, the method returns the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the updateAutoSign method:
Delete Auto Sign
The deleteAutoSign method is part of the AutoSign class. It's used to delete an auto sign request in the eSign API.
Parameters
The method takes the following parameters:
- $id: The ID of the auto sign request.
- $token: The authentication token.
Return Value
If the request is successful, the method returns true. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the deleteAutoSign method:
Detail Auto Sign
The detailAutoSign method is part of the AutoSign class. It's used to get the details of an auto sign request from the eSign API.
Parameters
The method takes the following parameters:
- $id: The ID of the auto sign request.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the detailAutoSign method:
List Auto Sign
The listAutoSign method is part of the AutoSign class. It's used to get a list of auto sign requests from the eSign API.
Parameters
The method takes the following parameters:
- $docMakerEmail: The email of the document maker.
- $signerEmail: The email of the signer.
- $page: The page number.
- $limit: The number of items per page.
- $token: The authentication token.
Return Value
If the request is successful, the method returns an associative array containing the response data from the API. If the request fails, it throws an exception with an error message.
Usage
Here's an example of how to use the listAutoSign method: