Skip to content

DocSpring/docspring-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

deb6f66 · Mar 22, 2025

History

14 Commits
Mar 22, 2025
Mar 22, 2025
Mar 22, 2025
Mar 22, 2025
Dec 19, 2023
Nov 8, 2019
Dec 19, 2023
Nov 8, 2019
Dec 19, 2023
Mar 22, 2025
Nov 18, 2020
Mar 22, 2025
Mar 22, 2025
Mar 22, 2025
Dec 19, 2023
Feb 26, 2025

Repository files navigation

DocSpring

DocSpring provides an API that helps you fill out and sign PDF templates.

Installation & Usage

Requirements

PHP 7.4 and later. Should also work with PHP 8.0.

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\PDFApi(
    // 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 PDFApi->addFieldsToTemplate: ', $e->getMessage(), PHP_EOL;
}

API Endpoints

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

Class Method HTTP request Description
PDFApi addFieldsToTemplate PUT /templates/{template_id}/add_fields Add new fields to a Template
PDFApi batchGeneratePdfs POST /submissions/batches Generates multiple PDFs
PDFApi combinePdfs POST /combined_submissions?v=2 Merge submission PDFs, template PDFs, or custom files
PDFApi combineSubmissions POST /combined_submissions Merge generated PDFs together
PDFApi copyTemplate POST /templates/{template_id}/copy Copy a Template
PDFApi createCustomFileFromUpload POST /custom_files Create a new custom file from a cached presign upload
PDFApi createDataRequestEvent POST /data_requests/{data_request_id}/events Creates a new event for emailing a signee a request for signature
PDFApi createDataRequestToken POST /data_requests/{data_request_id}/tokens Creates a new data request token for form authentication
PDFApi createFolder POST /folders/ Create a folder
PDFApi createHTMLTemplate POST /templates?endpoint_description=html Create a new HTML template
PDFApi createPDFTemplate POST /templates Create a new PDF template with a form POST file upload
PDFApi createPDFTemplateFromUpload POST /templates?endpoint_description=cached_upload Create a new PDF template from a cached presign upload
PDFApi deleteFolder DELETE /folders/{folder_id} Delete a folder
PDFApi deleteTemplate DELETE /templates/{template_id} Delete a template
PDFApi expireCombinedSubmission DELETE /combined_submissions/{combined_submission_id} Expire a combined submission
PDFApi expireSubmission DELETE /submissions/{submission_id} Expire a PDF submission
PDFApi generatePdf POST /templates/{template_id}/submissions Generates a new PDF
PDFApi generatePdfForHtmlTemplate POST /templates/{template_id}/submissions?endpoint_description=html_templates Generates a new PDF for an HTML template
PDFApi generatePreview POST /submissions/{submission_id}/generate_preview Generated a preview PDF for partially completed data requests
PDFApi getCombinedSubmission GET /combined_submissions/{combined_submission_id} Check the status of a combined submission (merged PDFs)
PDFApi getDataRequest GET /data_requests/{data_request_id} Look up a submission data request
PDFApi getFullTemplate GET /templates/{template_id}?full=true Fetch the full attributes for a PDF template
PDFApi getPresignUrl GET /uploads/presign Get a presigned URL so that you can upload a file to our AWS S3 bucket
PDFApi getSubmission GET /submissions/{submission_id} Check the status of a PDF
PDFApi getSubmissionBatch GET /submissions/batches/{submission_batch_id} Check the status of a submission batch job
PDFApi getTemplate GET /templates/{template_id} Check the status of an uploaded template
PDFApi getTemplateSchema GET /templates/{template_id}/schema Fetch the JSON schema for a template
PDFApi listCombinedSubmissions GET /combined_submissions Get a list of all combined submissions
PDFApi listFolders GET /folders/ Get a list of all folders
PDFApi listSubmissions GET /submissions List all submissions
PDFApi listTemplateSubmissions GET /templates/{template_id}/submissions List all submissions for a given template
PDFApi listTemplates GET /templates Get a list of all templates
PDFApi moveFolderToFolder POST /folders/{folder_id}/move Move a folder
PDFApi moveTemplateToFolder POST /templates/{template_id}/move Move Template to folder
PDFApi publishTemplateVersion POST /templates/{template_id}/publish_version Publish a template version
PDFApi renameFolder POST /folders/{folder_id}/rename Rename a folder
PDFApi restoreTemplateVersion POST /templates/{template_id}/restore_version Restore a template version
PDFApi testAuthentication GET /authentication Test Authentication
PDFApi updateDataRequest PUT /data_requests/{data_request_id} Update a submission data request
PDFApi updateTemplate PUT /templates/{template_id} Update a Template

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: 2.1.0
    • Generator version: 7.11.0
  • Build package: org.openapitools.codegen.languages.PhpClientCodegen