Developer Guide

How to Sign PDFs with PHP

3 steps to sign a PDF with PHP: Install the TurboDocx SDK with composer require turbodocx/sdk, configure TurboSign::configure() with your API key, org ID, and sender email, then call TurboSign::sendSignature() with a request listing recipients and signature fields. TurboDocx emails each recipient a signing link automatically.

This guide shows you how to integrate e-signatures into your Laravel or Symfony application in under 5 minutes.

Last updated: September 23, 2026

5 min

Setup time

PHP

PHP 8.1+

Modern enums

Type-Safe

Typed classes

1

Installation

Install the TurboDocx SDK via Composer. The package uses modern PHP 8.1+ features including enums and typed properties.

Composer
composer require turbodocx/sdk

Requirements: PHP 8.1+, Composer, ext-json, ext-fileinfo. Compatible with Laravel, Symfony, and vanilla PHP.

2

Obtaining an API Key

Before you begin, you'll need your API credentials from the TurboDocx dashboard.

  1. Sign up for a free account at TurboDocx
  2. Navigate to Settings → API Keys
  3. Copy your API Key and Organization ID
.env
TURBODOCX_API_KEY=your_api_key_here
TURBODOCX_ORG_ID=your_org_id_here
TURBODOCX_SENDER_EMAIL=you@company.com
TURBODOCX_SENDER_NAME=Your Company Name
3

Sending a Signing Request

Use the SDK to send a document for signature. The recipient will receive an email with a link to sign.

SendSignature.php
<?php

use TurboDocx\TurboSign;
use TurboDocx\Config\HttpClientConfig;
use TurboDocx\Types\Recipient;
use TurboDocx\Types\Field;
use TurboDocx\Types\SignatureFieldType;
use TurboDocx\Types\TemplateConfig;
use TurboDocx\Types\FieldPlacement;
use TurboDocx\Types\Requests\SendSignatureRequest;

// Configure with your API credentials
TurboSign::configure(new HttpClientConfig(
    apiKey: $_ENV['TURBODOCX_API_KEY'],
    orgId: $_ENV['TURBODOCX_ORG_ID'],
    senderEmail: $_ENV['TURBODOCX_SENDER_EMAIL'],  // REQUIRED
    senderName: $_ENV['TURBODOCX_SENDER_NAME']     // Recommended
));

// Send document for signature
$result = TurboSign::sendSignature(
    new SendSignatureRequest(
        recipients: [
            new Recipient('John Doe', 'john@example.com', 1)
        ],
        fields: [
            new Field(
                type: SignatureFieldType::SIGNATURE,
                recipientEmail: 'john@example.com',
                template: new TemplateConfig(
                    anchor: '{signature1}',
                    placement: FieldPlacement::REPLACE,
                    size: ['width' => 100, 'height' => 30]
                )
            )
        ],
        file: file_get_contents('contract.pdf'),
        documentName: 'Partnership Agreement'
    )
);

echo "Document ID: {$result->documentId}\n";

Modern PHP: Uses PHP 8.1+ features like enums (SignatureFieldType::SIGNATURE) and named parameters for type safety.

4

Processing Results with Webhooks

Configure webhooks to receive real-time notifications when documents are signed. Verify the X-TurboDocx-Signature header with verifyWebhookSignature() against the raw request body before trusting a payload.

WebhookController.php (Laravel)
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use TurboDocx\TurboSign;
use function TurboDocx\Utils\verifyWebhookSignature;

class WebhookController extends Controller
{
    public function handle(Request $request)
    {
        $rawBody = $request->getContent();
        if (!verifyWebhookSignature(
            $rawBody,
            $request->header('X-TurboDocx-Signature', ''),
            $request->header('X-TurboDocx-Timestamp', ''),
            $_ENV['TURBODOCX_WEBHOOK_SECRET'],
        )) {
            return response()->json(['error' => 'invalid signature'], 401);
        }

        $event = $request->input('event');
        $data = $request->input('data');

        if ($event === 'signature.document.completed') {
            $documentId = $data['document_id'];

            // Download the signed PDF
            $signedPdf = TurboSign::download($documentId);

            // Save to storage
            Storage::put("signed/{$documentId}.pdf", $signedPdf);
        }

        return response()->json(['received' => true]);
    }
}
5

Conclusion

You now have everything you need to integrate document signing into your PHP application using the TurboDocx e-signature API. The typed SDK handles authentication, document delivery, signature collection, and legally-binding audit trails.

What you can do next:

  • Add multiple recipients with sequential signing order
  • Use different field types: initials, dates, text, checkboxes
  • Integrate with Laravel Queues for async processing
  • Get audit trails and compliance certificates

Related Guides

Resources

Frequently Asked Questions

How do I sign a PDF with PHP?

Install the TurboDocx SDK (composer require turbodocx/sdk), configure it with your API key, then use TurboSign::sendSignature() to send the document for e-signature.

Is there a PHP digital signature SDK for Composer projects?

Yes. composer require turbodocx/sdk installs a typed digital signature SDK for PHP 8.1+ with enums and typed request classes, so Laravel and Symfony apps get IDE autocomplete for recipients, fields, and signature placement.

Does the PHP SDK work with Laravel?

Yes, the TurboDocx PHP SDK works with Laravel, Symfony, and any PHP 8.1+ application. It uses typed classes and enums for full IDE support.

What PHP version is required?

The TurboDocx PHP SDK requires PHP 8.1 or higher.

Ready to Get Started?

Create a free account and get your API key. Start sending documents for signature in minutes.