Skip to content

DocSpring/docspring-php

Repository files navigation

DocSpring

Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.

Installation & Usage

Requirements

PHP 8.1 and later.

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/docspring/docspring.git"
    }
  ],
  "require": {
    "docspring/docspring": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/DocSpring/vendor/autoload.php');

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure HTTP basic authorization: api_token_basic
$config = DocSpring\Configuration::getDefaultConfiguration()
              ->setUsername('YOUR_USERNAME')
              ->setPassword('YOUR_PASSWORD');


$apiInstance = new DocSpring\Api\Client(
    // 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(),
    $config
);
$template_id = tpl_1234567890abcdef02; // string
$data = new \DocSpring\Model\AddFieldsData(); // \DocSpring\Model\AddFieldsData

try {
    $result = $apiInstance->addFieldsToTemplate($template_id, $data);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling Client->addFieldsToTemplate: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

All URIs are relative to https://sync.api.docspring.com/api/v1

Class Method HTTP request Description
Client addFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
Client batchGeneratePdfs POST /submissions/batches Generate multiple PDFs
Client combinePdfs POST /combined_submissions Merge submission PDFs, template PDFs, or custom files
Client copyTemplate POST /templates/{template_id}/copy Copy a template
Client createCustomFileFromUpload POST /custom_files Create a new custom file from a cached S3 upload
Client createDataRequestEvent POST /data_requests/{data_request_id}/events Create a new event for emailing a signee a request for signature
Client createDataRequestToken POST /data_requests/{data_request_id}/tokens Create a new data request token for form authentication
Client createFolder POST /folders/ Create a folder
Client createHtmlTemplate POST /templates?endpoint_variant=create_html_template Create a new HTML template
Client createPdfTemplate POST /templates Create a new PDF template with a form POST file upload
Client createPdfTemplateFromUpload POST /templates?endpoint_variant=create_template_from_cached_upload Create a new PDF template from a cached S3 file upload
Client deleteFolder DELETE /folders/{folder_id} Delete a folder
Client deleteTemplate DELETE /templates/{template_id} Delete a template
Client expireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
Client expireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
Client generatePdf POST /templates/{template_id}/submissions Generate a PDF
Client generatePreview POST /submissions/{submission_id}/generate_preview Generate a preview PDF for partially completed data requests
Client getCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
Client getDataRequest GET /data_requests/{data_request_id} Look up a submission data request
Client getFullTemplate GET /templates/{template_id}?full=true Fetch the full attributes for a PDF template
Client getPresignUrl GET /uploads/presign Get a presigned S3 URL for direct file upload
Client getSubmission GET /submissions/{submission_id} Check the status of a PDF
Client getSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
Client getTemplate GET /templates/{template_id} Check the status of an uploaded template
Client getTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
Client listCombinedSubmissions GET /combined_submissions Get a list of all combined submissions
Client listFolders GET /folders/ Get a list of all folders
Client listSubmissions GET /submissions List all submissions
Client listTemplateSubmissions GET /templates/{template_id}/submissions List all submissions for a given template
Client listTemplates GET /templates Get a list of all templates
Client moveFolderToFolder POST /folders/{folder_id}/move Move a folder
Client moveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
Client publishTemplateVersion POST /templates/{template_id}/publish_version Publish a template version
Client renameFolder POST /folders/{folder_id}/rename Rename a folder
Client restoreTemplateVersion POST /templates/{template_id}/restore_version Restore a template version
Client testAuthentication GET /authentication Test authentication
Client updateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
Client updateTemplate PUT /templates/{template_id} Update a Template
Client updateTemplateDocument PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_form_post Update a template's document with a form POST file upload
Client updateTemplateDocumentFromUpload PUT /templates/{template_id}?endpoint_variant=update_template_pdf_with_cached_upload Update a template's document with a cached S3 file upload

Models

Authorization

Authentication schemes defined for the API:

api_token_basic

  • Type: HTTP basic authentication

Tests

To run the tests, use:

composer install
vendor/bin/phpunit

Author

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: v1
    • Package version: 3.0.0
    • Generator version: 7.16.0-DOCSPRING
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen

About

PHP API Client for DocSpring

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •