PHPackages                             mrnewport/laravel-docsign - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. mrnewport/laravel-docsign

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

mrnewport/laravel-docsign
=========================

Document Generation &amp; E-Signatures for Laravel.

v1.0.0(1y ago)10MITPHPPHP &gt;=8.1

Since Jan 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/MrNewport/laravel-docsign)[ Packagist](https://packagist.org/packages/mrnewport/laravel-docsign)[ RSS](/packages/mrnewport-laravel-docsign/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (10)Versions (2)Used By (0)

Laravel Document Generation &amp; E-Signatures (mrnewport/laravel-docsign)
==========================================================================

[](#laravel-document-generation--e-signatures-mrnewportlaravel-docsign)

A **config-driven**, **expandable** package for **document generation** (multiple PDF and template engines) and **e-signatures** (multiple providers). Ideal for any use case—from real estate lease agreements, NDAs, or HR forms, to finance, legal, and more.

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
    - [PDF Renderer](#pdf-renderer)
    - [Template Engine](#template-engine)
    - [Signature Providers](#signature-providers)
    - [Storage Disk](#storage-disk)
- [Usage](#usage)
    - [Creating a Document](#creating-a-document)
    - [Generating a PDF](#generating-a-pdf)
    - [Requesting E-Signatures](#requesting-e-signatures)
    - [Handling Callbacks](#handling-callbacks)
    - [Example Multi-Signer Flow](#example-multi-signer-flow)
- [Advanced &amp; Unusual Use Cases](#advanced--unusual-use-cases)
    - [Versioning Documents](#versioning-documents)
    - [Security &amp; Encryption](#security--encryption)
    - [Docker Environments](#docker-environments)
    - [Notifications &amp; Webhooks](#notifications--webhooks)
- [Expandability](#expandability)
    - [Custom PDF Engines](#custom-pdf-engines)
    - [Custom Template Engines](#custom-template-engines)
    - [Custom Signature Providers](#custom-signature-providers)
- [Testing](#testing)
- [License](#license)

---

Features
--------

[](#features)

1. **Multi-Engine PDFs**: DomPDF or wkhtmltopdf (plus custom).
2. **Multi-Engine Templates**: Blade or Twig (plus custom).
3. **Pluggable E-Sign**: Local (demo), DocuSign, HelloSign.
4. **Config-Driven**: Swap engines and providers in `docsign.php` without editing package code.
5. **Storage Disk** support for PDF files.
6. **Facade**-based usage: `DocSign::generate(...)`, `DocSign::requestSignature(...)`, etc.

---

Requirements
------------

[](#requirements)

- **PHP** `>=8.1`
- **Laravel** `^11.0`
- If using **wkhtmltopdf**, install the binary on your server/CI environment.

---

Installation
------------

[](#installation)

1. **Require the package**:

    ```
    composer require mrnewport/laravel-docsign
    ```
2. **Publish config** (optional):

    ```
    php artisan vendor:publish --provider="MrNewport\LaravelDocSign\Providers\DocSignServiceProvider" --tag=docsign-config
    ```
3. **Migrate**:

    ```
    php artisan migrate
    ```

**Done**—you can now generate docs, request signatures, handle callbacks.

---

Configuration
-------------

[](#configuration)

All config is in **`src/config/docsign.php`** (published to `config/docsign.php` if you run the above publish command). **No** direct package edits required—just tweak config to your needs.

### PDF Renderer

[](#pdf-renderer)

```
'pdf_renderer' => 'dompdf', // or 'wkhtml' or a custom key
'pdf_options' => [
  'paper' => 'A4',
  'orientation' => 'portrait'
],
```

- `'dompdf'` uses a pure-PHP library.
- `'wkhtml'` uses `wkhtmltopdf` (system binary).
- For custom, see [Custom PDF Engines](#custom-pdf-engines).

### Template Engine

[](#template-engine)

```
'template_engine' => 'blade', // or 'twig' or a custom key
```

- `'blade'` integrates standard Laravel Blade.
- `'twig'` uses Twig.
- For your own engine, see [Custom Template Engines](#custom-template-engines).

### Signature Providers

[](#signature-providers)

```
'signature' => [
  'default' => 'local',
  'providers' => [
    'local' => [...],
    'docusign' => [...],
    'hellosign' => [...]
  ],
],
```

- `'local'` is a demo.
- `'docusign'`, `'hellosign'` are stubs for real external e-sign flows.
- Provide `'api_key'` or `'callback_url'` as needed.

### Storage Disk

[](#storage-disk)

```
'storage_disk' => 'local'
```

Defines which disk (from `config/filesystems.php`) to store final PDFs. E.g., `'s3'` or `'local'`.

---

Usage
-----

[](#usage)

### Creating a Document

[](#creating-a-document)

```
use MrNewport\LaravelDocSign\Models\Document;

$document = Document::create([
    'title' => 'NDA Example',
    'data' => [
      '_template' => 'docsign::nda',
      'partyA' => 'Company X',
      'partyB' => 'John Doe'
    ]
]);
```

- `title` is used for naming the PDF.
- `data` merges into the template, storing placeholders like `'partyA'`.

### Generating a PDF

[](#generating-a-pdf)

```
use MrNewport\LaravelDocSign\Facades\DocSign;

$path = DocSign::generate($document);
// merges template -> renders PDF -> saves to disk -> sets doc.status='draft'
```

### Requesting E-Signatures

[](#requesting-e-signatures)

```
$signers = [
  ['name'=>'John','email'=>'john@example.com'],
  ['name'=>'Jane','email'=>'jane@example.com']
];

$result = DocSign::requestSignature($document, $signers);
// sets doc.status='signing', returns array e.g. ['url'=>'...']
```

You might redirect the user to `$result['url']` if it’s an external signature page.

### Handling Callbacks

[](#handling-callbacks)

1. In config, each provider has a `'callback_url'`.
2. The package routes `POST /docsign/callback/{provider}` to `RouteCallbacks@signatureCallback`.
3. That calls `DocSign::handleCallback($provider, $request)`.
4. The provider then sets doc.status='completed' (or similar).

### Example Multi-Signer Flow

[](#example-multi-signer-flow)

If you need signers in a specific **order** or multiple separate sign events:

- Your own application logic can track each signer’s completion.
- Possibly re-call `requestSignature(...)` with the next signer or pass an array with `'order'` keys.
- The package’s built-in providers are minimal stubs; advanced signers with multi-step flows are possible if you create a custom provider (or expand the existing ones).

---

Advanced &amp; Unusual Use Cases
--------------------------------

[](#advanced--unusual-use-cases)

### Versioning Documents

[](#versioning-documents)

If you want doc versioning:

1. **Add** a `version` column to `documents`.
2. **Before** re-generating, increment doc.version in your application logic.
3. Store old PDFs under a versioned filename.

### Security &amp; Encryption

[](#security--encryption)

For truly sensitive docs:

- You can implement encryption at rest using a custom disk driver (e.g., S3’s server-side encryption).
- If you need password-protected PDFs, certain renderers or PDF post-processing can do that.

### Docker Environments

[](#docker-environments)

If using **wkhtmltopdf** in Docker:

1. Add `RUN apt-get update && apt-get install -y wkhtmltopdf` (or a specialized image).
2. Possibly store the path in `.env` as `WKHTMLTOPDF_PATH=/usr/bin/wkhtmltopdf`.
3. The package’s test can skip if `wkhtmltopdf` isn’t found.

### Notifications &amp; Webhooks

[](#notifications--webhooks)

Your application can:

- Listen for `'docsign.callback'` route and then send emails or Slack messages.
- Fire your own events upon doc creation, signature requested, or completion.

---

Expandability
-------------

[](#expandability)

### Custom PDF Engines

[](#custom-pdf-engines)

1. Create a class implementing `MrNewport\LaravelDocSign\Services\Pdf\PdfRendererInterface`.
2. **Bind** it in your app: ```
    $this->app->bind('docsign.pdf_renderer.mycustom', function($app){
        return new \App\Pdf\MyCustomRenderer();
    });
    ```
3. Set `'pdf_renderer' => 'mycustom'` in `docsign.php`.

### Custom Template Engines

[](#custom-template-engines)

1. Implement `MrNewport\LaravelDocSign\Services\Template\TemplateEngineInterface`.
2. Bind in your **AppServiceProvider**: ```
    $this->app->bind('docsign.template_engine.markdown', function($app){
        return new \App\Template\MarkdownEngine();
    });
    ```
3. `'template_engine' => 'markdown'`.

### Custom Signature Providers

[](#custom-signature-providers)

1. Implement `SignatureProviderInterface`.
2. Add it to `config('docsign.signature.providers')`.
3. **No** package edits. If `'key' => 'mysigner'`, then `'class' => \App\Signing\MySignerProvider::class`.

---

Testing
-------

[](#testing)

```
composer test
```

- **DocumentTest**: verifies doc creation &amp; PDF generation.
- **SignatureTest**: checks requestSignature + local callback.
- **PdfTest**: tests DomPDF or Wkhtml if installed.
- **TemplateTest**: tests Blade &amp; Twig.

In CI or local dev, ensure you have **wkhtmltopdf** installed if you want that test to pass. DomPDF-based tests do not require extra binaries.

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE). Expand it solely via **config** or **custom classes**—**never** by editing the package’s internal files. Enjoy your dynamic documents and e-sign workflows!

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19dc283a8ecb45d1efbc444dc510eb63c8aab21427be09f3c1aefd507a5ab40c?d=identicon)[mrnewport](/maintainers/mrnewport)

---

Top Contributors

[![MrNewport](https://avatars.githubusercontent.com/u/48736345?v=4)](https://github.com/MrNewport "MrNewport (1 commits)")

---

Tags

esignaturepdfpdf-generationsign

### Embed Badge

![Health badge](/badges/mrnewport-laravel-docsign/health.svg)

```
[![Health](https://phpackages.com/badges/mrnewport-laravel-docsign/health.svg)](https://phpackages.com/packages/mrnewport-laravel-docsign)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k2](/packages/mike-bronner-laravel-model-caching)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M154](/packages/laravel-pulse)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
