# DocuSeal PHP
The DocuSeal PHP library provides seamless integration with the DocuSeal API, allowing developers to interact with DocuSeal's electronic signature and document management features directly within PHP applications. This library is designed to simplify API interactions and provide tools for efficient implementation.
## Documentation
Detailed documentation is available at [DocuSeal API Docs](https://www.docuseal.com/docs/api?lang=php).
## Requirements
PHP 5.6.0 and later.
## Installation
To install using [Composer](http://getcomposer.org/):
```sh
composer require docusealco/docuseal-php
```
To use the bindings, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):
```php
require_once 'vendor/autoload.php';
```
## Manual Installation
Download the latest docuseal-php package and then, include the init.php file:
```php
require_once '/path/to/docuseal-php/init.php';
```
## Usage
### Configuration
Set up the library with your DocuSeal API key based on your deployment. Retrieve your API key from the appropriate location:
#### Global Cloud
API keys for the global cloud can be obtained from your [Global DocuSeal Console](https://console.docuseal.com/api).
```ts
$docuseal = new \Docuseal\Api('API_KEY');
```
#### EU Cloud
API keys for the EU cloud can be obtained from your [EU DocuSeal Console](https://console.docuseal.eu/api).
```ts
$docuseal = new \Docuseal\Api('API_KEY', 'https://api.docuseal.eu');
```
#### On-Premises
For on-premises installations, API keys can be retrieved from the API settings page of your deployed application, e.g., https://yourdocusealapp.com/settings/api.
```ts
$docuseal = new \Docuseal\Api('API_KEY', 'https://yourdocusealapp.com/api');
```
## API Methods
### listSubmissions(params)
[Documentation](https://www.docuseal.com/docs/api?lang=php#list-all-submissions)
Provides the ability to retrieve a list of available submissions.
```php
$docuseal->listSubmissions(['limit' => 10]);
```
### getSubmission(id)
[Documentation](https://www.docuseal.com/docs/api?lang=php#get-a-submission)
Provides the functionality to retrieve information about a submission.
```php
$docuseal->getSubmission(1001);
```
### getSubmissionDocuments(id)
[Documentation](https://www.docuseal.com/docs/api?lang=php#get-submission-documents)
This endpoint returns a list of partially filled documents for a submission. If the submission has been completed, the final signed documents are returned.
```php
$docuseal->getSubmissionDocuments(1001);
```
### createSubmission(data)
[Documentation](https://www.docuseal.com/docs/api?lang=php#create-a-submission)
This API endpoint allows you to create signature requests (submissions) for a document template and send them to the specified submitters (signers).
**Related Guides:**
[Send documents for signature via API](https://www.docuseal.com/guides/send-documents-for-signature-via-api)
[Pre-fill PDF document form fields with API](https://www.docuseal.com/guides/pre-fill-pdf-document-form-fields-with-api)
```php
$docuseal->createSubmission([
'template_id' => 1000001,
'send_email' => true,
'submitters' => [
[
'role' => 'First Party',
'email' => 'john.doe@example.com'
]
]
]);
```
### createSubmissionFromPdf(data)
[Documentation](https://www.docuseal.com/docs/api?lang=php#create-a-submission-from-pdf)
Provides the functionality to create one-off submission request from a PDF. Use `{{Field Name;role=Signer1;type=date}}` text tags to define fillable fields in the document. See [https://www.docuseal.com/examples/fieldtags.pdf](https://www.docuseal.com/examples/fieldtags.pdf) for more text tag formats. Or specify the exact pixel coordinates of the document fields using `fields` param.
**Related Guides:**
[Use embedded text field tags to create a fillable form](https://www.docuseal.com/guides/use-embedded-text-field-tags-in-the-pdf-to-create-a-fillable-form)
```php
$docuseal->createSubmissionFromPdf([
'name' => 'Test Submission Document',
'documents' => [
[
'name' => 'string',
'file' => 'base64',
'fields' => [
[
'name' => 'string',
'areas' => [
[
'x' => 0,
'y' => 0,
'w' => 0,
'h' => 0,
'page' => 1
]
]
]
]
]
],
'submitters' => [
[
'role' => 'First Party',
'email' => 'john.doe@example.com'
]
]
]);
```
### createSubmissionFromDocx(data)
[Documentation](https://www.docuseal.com/docs/api?lang=php#create-a-submission-from-docx)
Provides functionality to create a one-off submission request from a DOCX file with dynamic content variables. Use `[[variable_name]]` text tags to define dynamic content variables in the document. See [https://www.docuseal.com/examples/demo\_template.docx](https://www.docuseal.com/examples/demo_template.docx) for the specific text variable syntax, including dynamic content tables and list. You can also use the `{{signature}}` fillable field syntax to define fillable fields, as in a PDF.
**Related Guides:**
[Use embedded text field tags to create a fillable form](https://www.docuseal.com/guides/use-embedded-text-field-tags-in-the-pdf-to-create-a-fillable-form)
```php
$docuseal->createSubmissionFromDocx([
'name' => 'Test Submission Document',
'variables' => [
'variable_name' => 'value'
],
'documents' => [
[
'name' => 'string',
'file' => 'base64'
]
],
'submitters' => [
[
'role' => 'First Party',
'email' => 'john.doe@example.com'
]
]
]);
```
### createSubmissionFromHtml(data)
[Documentation](https://www.docuseal.com/docs/api?lang=php#create-a-submission-from-html)
This API endpoint allows you to create a one-off submission request document using the provided HTML content, with special field tags rendered as a fillable and signable form.
**Related Guides:**
[Create PDF document fillable form with HTML](https://www.docuseal.com/guides/create-pdf-document-fillable-form-with-html-api)
```php
$docuseal->createSubmissionFromHtml([
'name' => 'Test Submission Document',
'documents' => [
[
'name' => 'Test Document',
'html' => '
Lorem Ipsum is simply dummy text of the
Lorem Ipsum is simply dummy text of the