定制 kukux/digital-signature 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kukux/digital-signature

Composer 安装命令:

composer require kukux/digital-signature

包简介

A Laravel Filament package for digital signature capture, certificate issuance, and PDF signing (v3 + v4 + v5 compatible).

README 文档

README

Latest Version on Packagist Total Downloads License

A Laravel Filament plugin for capturing signatures, issuing X.509 certificates, and embedding cryptographically signed stamps into PDF documents.

Supports: Filament v4 and v5 — Laravel 11 / 12 — PHP 8.2+

Documentation

Doc Description
Installation Composer, migrations, plugin registration, admin resource
Configuration All config keys and env variables
Model Setup Signable interface and HasSignatures trait
Filament Components SignaturePad, SignatureColumn, SignatureResource, SignDocumentAction
Signing Workflow Full lifecycle and SignatureManager API
Ad-hoc Signing Implement document signing outside a package resource
Certificates Certificate issuance, CA setup, CFSSL
Security HMAC metadata, machine binding, DB cross-validation, forgery detection

Requirements

  • PHP 8.2+ with ext-openssl and ext-gd
  • Laravel 11 or 12
  • Filament 3, 4, or 5

Quick Install

composer require kukux/digital-signature
php artisan vendor:publish --tag=signature-migrations
php artisan vendor:publish --tag=signature-config
php artisan migrate
php artisan filament:assets

filament:assets publishes the plugin's JS bundle (signature pad + picker) so it's reachable from the panel — re-run it after every composer update of this package.

Register the plugin in your panel provider:

// app/Providers/Filament/AdminPanelProvider.php
use Kukux\DigitalSignature\SignaturePlugin;

->plugins([
    SignaturePlugin::make()
        ->navigationGroup('Documents')   // optional
        ->navigationIcon('heroicon-o-pencil-square')  // optional
        ->navigationSort(10),             // optional
])

This registers:

  • Signatures — a full admin resource for registering reusable signature images and viewing signature records
  • Sign Document — header actions inside the Signatures resource for signing with a registered signature

Preparing a Signable Model

Any model whose PDF can be signed must implement Signable and use HasSignatures.

use Kukux\DigitalSignature\Contracts\Signable;
use Kukux\DigitalSignature\Traits\HasSignatures;

class Contract extends Model implements Signable
{
    use HasSignatures;

    public function getSignableTitle(): string   { return $this->title; }
    public function getSignablePdfPath(): string { return $this->pdf_path; }
    public function getSignableId(): int|string  { return $this->id; }
}

Adding the Sign Action to Your Own Resource

First let the signer register a reusable signature from the built-in Signatures resource. Then add SignDocumentAction to any resource whose model implements Signable.

use Kukux\DigitalSignature\Filament\Actions\SignDocumentAction;
use Kukux\DigitalSignature\Filament\Columns\SignatureColumn;

class ContractResource extends Resource
{
    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('title'),
                SignatureColumn::make('signature')->thumbSize(80, 32),
            ])
            ->actions([
                SignDocumentAction::make()
                    ->stampAt(page: 1, x: 100, y: 650, w: 200, h: 80),
            ]);
    }
}

For controller-driven or custom page flows, see Ad-hoc Signing.

Built-in Signatures Admin Resource

When the plugin is registered, a Signatures resource appears in the sidebar automatically.

Register SignaturePlugin::make() on every Filament panel that should use the package. If a panel discovers or registers SignatureResource without the plugin, Filament can report Plugin [signature] is not registered for panel [admin].

List page — table of all signature records with thumbnail, signer, status, and method.
View page — full infolist showing the large signature image, signer details, security metadata.

Both pages include a Sign Document header action.

Customize appearance:

SignaturePlugin::make()
    ->navigationGroup('Documents')
    ->navigationIcon('heroicon-o-pencil-square')
    ->navigationSort(10)
    ->navigationLabel('Document Signatures')

// Disable the resource entirely (bring your own):
SignaturePlugin::make()->withoutResource()

Security Highlights

Feature Default
PKCS#7 cryptographic signature embedded in PDF Always on
DocMDP P=2 — post-signing modification detection Always on
HMAC-signed PNG metadata (tEXt + XMP) Always on
XMP metadata visible in macOS Preview & Windows Explorer Always on
Signer identity (name + email) embedded in PNG Always on
Forgery / screenshot upload rejection Always on
Document integrity hashes (before + after) Always on
Machine binding — DB cross-validation on re-upload Always on
Machine lock — reject re-upload from different device SIGNATURE_MACHINE_LOCK=true
CRL certificate revocation check SIGNATURE_CRL_ENABLED=true
RFC 3161 trusted timestamp via TSA SIGNATURE_TSA_URL=https://...

For full details see docs/security.md.

Queue

Signing runs asynchronously. Start a queue worker:

php artisan queue:work

To sign synchronously (no queue required):

SignDocumentAction::make()   // default is now synchronous

The action calls embedAndFinalize() directly unless you opt in to queued signing:

SignDocumentAction::make()->queued()

kukux/digital-signature 适用场景与选型建议

kukux/digital-signature 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 61 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「pdf」 「laravel」 「signature-pad」 「pki」 「digital-signature」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kukux/digital-signature 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kukux/digital-signature 我们能提供哪些服务?
定制开发 / 二次开发

基于 kukux/digital-signature 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 61
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 36
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-15