Skip to content

DocSpring/docspring-php

Repository files navigation

DocSpring

DocSpring is a service 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_000000000000000002; // 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://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 batchGeneratePdfV1 POST /templates/{template_id}/submissions/batch Generates multiple PDFs
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 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?desc=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?desc=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 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 template attributes
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 renameFolder POST /folders/{folder_id}/rename Rename a folder
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.0.0
  • Build package: com.docspring.codegen.DocSpringPhpClientCodegen